home *** CD-ROM | disk | FTP | other *** search
/ Aminet 41 / Aminet 41 (2001)(Schatztruhe)[!][Feb 2001].iso / Aminet / docs / misc / MuManual.lha / MuManual / Autodocs / mmu.doc < prev    next >
Encoding:
Text File  |  2000-10-08  |  121.1 KB  |  3,639 lines

  1. TABLE OF CONTENTS
  2.  
  3. mmu.library/--Background--
  4. mmu.library/--Patches--
  5. mmu.library/ActivateException
  6. mmu.library/AddContextHook
  7. mmu.library/AddMessageHook
  8. mmu.library/AllocAligned
  9. mmu.library/AllocLineVec
  10. mmu.library/AttemptLockContextList
  11. mmu.library/AttemptLockMMUContext
  12. mmu.library/BuildIndirect
  13. mmu.library/CopyContextRegion
  14. mmu.library/CopyMapping
  15. mmu.library/CreateMMUContext
  16. mmu.library/CurrentContext
  17. mmu.library/DeactivateException
  18. mmu.library/DefaultContext
  19. mmu.library/DeleteMMUContext
  20. mmu.library/DMAInitiate
  21. mmu.library/DMATerminate
  22. mmu.library/DupMapping
  23. mmu.library/EnterMMUContext
  24. mmu.library/GetIndirect
  25. mmu.library/GetMapping
  26. mmu.library/GetMappingProperties
  27. mmu.library/GetMMUContextData
  28. mmu.library/GetMMUType
  29. mmu.library/GetPageProperties
  30. mmu.library/GetPageSize
  31. mmu.library/GetProperties
  32. mmu.library/LeaveMMUContext
  33. mmu.library/LockContextList
  34. mmu.library/LockMMUContext
  35. mmu.library/NewMapping
  36. mmu.library/PhysicalLocation
  37. mmu.library/PhysicalPageLocation
  38. mmu.library/RebuildTree
  39. mmu.library/RebuildTrees
  40. mmu.library/ReleaseMapping
  41. mmu.library/RemapSize
  42. mmu.library/RemContextHook
  43. mmu.library/RemMessageHook
  44. mmu.library/RunOldConfig
  45. mmu.library/SetBusError
  46. mmu.library/SetIndirect
  47. mmu.library/SetIndirectArray
  48. mmu.library/SetMappingProperties
  49. mmu.library/SetMMUContextData
  50. mmu.library/SetPageProperties
  51. mmu.library/SetProperties
  52. mmu.library/SetPropertiesMapping
  53. mmu.library/SetPropertyList
  54. mmu.library/SuperContext
  55. mmu.library/UnlockContextList
  56. mmu.library/UnlockMMUContext
  57. mmu.library/WithoutMMU
  58.  
  59. mmu.library/--Background--             mmu.library/--Background--
  60.  
  61.     PURPOSE
  62.     The mmu.library provides functions for MMU related operations
  63.     as write- or read-protecting certain areas of memory for a
  64.     given set of tasks, or marking memory regions as "swapped"
  65.     virtual memory support. It offers an abstraction level on top
  66.     of the actual MMU and a unified interface for MMU purposes.
  67.  
  68.     The MMU lib does NOT implement virtual memory, that's the purpose
  69.     of another library - the memory.library. There's no much reason why
  70.     any application except the memory.library and probably some debugging
  71.     tools should call this library directly. The memory.library functions
  72.     on top of this library should suffer for "all day purposes".
  73.  
  74.     The basic object administrated by this library is the "context". A
  75.     "context" is the software abstraction of a MMU translation tree, it
  76.     keeps the information of the status of memory. The mmu.library 
  77.     provides a "global" context that represents the MMU translation tree
  78.     for all tasks. It is build by the init code of the library either by
  79.     snooping the already existing MMU translation tree or by building an
  80.     own tree by looking at the available memory and expansion devices.
  81.  
  82.     Programs can build own contexts by using the MMU library functions and
  83.     may enter or leave the contexts generated in this way. Several tasks
  84.     may share one context, as they represent, for example, multiple 
  85.     "threads" of one single program. Thus, the notation used here is some-
  86.     how turned around: A "context" in the amiga world is called "process"
  87.     in unix, and a "task" or "process" in the amiga world is called a
  88.     "thread" usually.
  89.  
  90.     Tasks that do not enter an own context explicitly share the common
  91.     global context. Even though it is possible to change the global 
  92.     context, this technique should be used only by debugging tools as the
  93.     enforcer. It could, for example, mark unused areas of the memory as
  94.     well as the first 4K as "invalid".
  95.  
  96.     The MMU library provides two "hooks" for each context, the 
  97.     "bus error hook" and the "segmentation fault" hook. The first hook
  98.     is called if an access to an invalid memory location is detected, or
  99.     a write to a read-only memory area. The second is called if an access
  100.     to a memory page marked as "swapped out" is detected. It's part of
  101.     the service of the MMU library to keep these two access violations
  102.     apart.
  103.  
  104.     The default hooks call simply the exception handler of the running
  105.     task, which generates by default the well known "guru". It's up to
  106.     programs on top of the MMU library to setup useful hooks. An enforcer
  107.     like tool might set "bus error hook" to print some useful information
  108.     about the access violation, the memory.library will set the 
  109.     "segmentation fault" hook to swap in the memory in question.
  110.  
  111.     The hooks are really "low-level" routines and are executed in super-
  112.     visor mode, and therefore very limited in power.
  113.  
  114.     The library provides itself a ready-for-use hook function which
  115.     sends a message to a task to be specified and suspends the task
  116.     that caused the bus error until the message is replied.
  117.  
  118.     MMU trees are managed on two levels, a "software abstraction level"
  119.     which is comfortable and easy to use. Memory "properties" of large
  120.     regions of memory can be redefined quite easely with one single
  121.     call, but rebuilding the MMU table tree from this abstraction layer
  122.     is a lengthly operation and requires quite a lot of CPU power
  123.     not available in critical applications.
  124.     Therefore, a more "hardware based" approach is available which
  125.     modifies the existing MMU table "on the fly" and is therefore
  126.     rather fast. However, memory pages to be handled like this must
  127.     be marked with the MAPP_SINGLE property to tell the library to
  128.     build the MMU table in a special way to allow fast modification
  129.     and to bypass some possible optimizations (e.g. "early page
  130.     terminators" and "invalid descriptors not at page level").
  131.     Modifications on this level are never seen by the abstraction
  132.     level above and should be used only once the MMU tree is complete.
  133.  
  134.     If that is, too, not fast enough, the MMU library allows building
  135.     pages using "indirect descriptors". That is, the page property
  136.     flags are given by a true hardware descriptor you provide. This
  137.     makes code CPU specific, obviously, but has the advantage that
  138.     page properties can be modified by a single long word "poke" in
  139.     your program, and the proper ATC flush. This is almost "hardware
  140.     banging", with some support.
  141.  
  142.     This method has one important drawback, namely that the library
  143.     is no longer able to disable caching for DMA transfer to and from
  144.     this page. Hence, NEVER EVER access an indirect page by DMA.
  145.  
  146. mmu.library/--Patches--                mmu.library/--Patches--
  147.  
  148.     To perform its job, the mmu.library has to install a number of 
  149.     system patches. I tried avoid this as best as possible, but some
  150.     installations have to be done.
  151.  
  152.     The following patches are installed:
  153.  
  154.  
  155. exec/CacheControl:      Replaced partially by a function that guarantees
  156.             that the data cache remains off when the mmu.library
  157.             builds descriptors.
  158.  
  159. exec/ColdReboot:    Replaced partially by a function that removes the
  160.             mmu.library installed MMU trees. This is done to
  161.             restart the processor with a clean MMU setup.
  162.  
  163. exec/Alert:        Replaced partially. The Alert() replacement routine
  164.             will check whether the alert caused is fatal or not,
  165.             and will Disable() and unload the mmu.library 
  166.             installed MMU tree if this is the case. Since a
  167.             deadend alert will go over into a reset without
  168.             calling ColdReboot(), this must be done here 
  169.             separately to ensure that the machine restarts
  170.             properly.
  171.  
  172. exec/AddMem:        Adding memory with a MMU setup active would or would
  173.             not mean that the MMU table must be adjusted to
  174.             reflect the changes. This function should not be
  175.             called once the system is setup and running.
  176.  
  177.             The current (42.3) implementation adds the memory
  178.             to the system and, additionally, modifies the MMU
  179.             tree of the public user and supervisor contexts 
  180.             to make this memory visible and available. Caching
  181.             modes are set accordingly: Imprecise for MEMF_CHIP,
  182.             Copyback for all others.
  183.  
  184.             I'm not quite positive that this is the best way
  185.             how to handle AddMem(), though. This function
  186.             shouldn't be called after bootstrap anyhow.
  187.  
  188. exec/AddConfigDev:      Called to make new hardware known to the system.
  189.             This function shouldn't be called by user code
  190.             after bootstrap anyhow.
  191.  
  192.             The current implementation modifies the public user
  193.             and supervisor contexts to make the added hardware
  194.             visible, provided it is not memory. In the former
  195.             case, the address range is set to cacheinhibited. In
  196.             the latter, nothing is done as AddMem() should be 
  197.             called instead.
  198.  
  199.             After MMU modifications, either the old expansion
  200.             library function is called, or an internal replace-
  201.             ment routine is made use of if expansion has been
  202.             patched over. This is necessary, unfortunately, since
  203.             some third-party libraries hack here the MMU tree,
  204.             which is undesirable.
  205.  
  206. exec/CachePreDMA:       Replaced completely by a MMU library routine that
  207.             disables copyback mode for non-aligned pages and
  208.             translates the logical address passed in to the
  209.             physical address, by means of the mmu.library 
  210.             public context.
  211.  
  212. exec/CachePostDMA:      Ditto. Replaced completely by the MMU.library.
  213.  
  214.     
  215.  
  216. mmu.library/CreateMMUContext               mmu.library/CreateContext               mmu.library/CreateMMUContext
  217.  
  218.     NAME
  219.     CreateMMUContext - Build a new MMU context.
  220.  
  221.     SYNOPSIS
  222.     context = CreateMMUContextA ( tags );
  223.     d0                   a0
  224.  
  225.     context = CreateMMUContext ( tag1, ... ); 
  226.  
  227.  
  228.     struct MMUContext * CreateMMUContextA ( struct TagItem *);
  229.  
  230.     struct MMUContext * CreateMMUContext ( Tag tag1, ... );
  231.     
  232.     FUNCTION
  233.     This function builds a new MMU context.
  234.  
  235.     INPUTS
  236.     tags    -   Tag items for the context to be created. 
  237.  
  238.     Currently defined tags are:
  239.  
  240.  
  241.     MCXTAG_COPY      -  build a copy of the context * passed in,
  242.                 if the pointer is NULL, build a copy of
  243.                 the global default context. (RECOMMENDED!)
  244.  
  245.                 If this tag item is not given, all context
  246.                 addresses will be marked as MAPP_BLANK. Most
  247.                 likely not what you want.
  248.  
  249.                 If you specify a different page size than that
  250.                 of the context you want to clone, you should
  251.                 specify the MCXTAG_ERRORCODE as well and study
  252.                 the return code carefully. The mmu library might
  253.                 have performed some rounding to fit the old
  254.                 table specifications into the new table layout.
  255.                 In worst case, this will make your new table
  256.                 unusable. It is therefore in general not a good
  257.                 idea to specify a page size larger than that of
  258.                 the cloned context. Even though the library 
  259.                 itself allocates all its internal structures
  260.                 aligned to "worst case" page sizes, this might
  261.                 not be true for external user programs.
  262.                 
  263.     MCXTAG_EXECBASE  -  allow accesses of AbsExecBase and all accesses to
  264.                 valid memory in the first page, even if this
  265.                 page in the MMU tree - the "zeropage" - is
  266.                 marked as invalid. This is an important feature
  267.                 if the mmu.library is used to implement an
  268.                 Enforcer type program. 
  269.                 Accesses will be emulated in software and are
  270.                 hence *slow*. They should be avoided, either by
  271.                 running Os 3.0 or better, or by using a tool like
  272.                 "MuMove4k".
  273.  
  274.                 AbsExecBase accesses are handled with highest
  275.                 priority and might be faster than the rest of the
  276.                 emulation, even faster than the Enforcer, even
  277.                 though they're still slower than "the real thing".
  278.                 It is not guaranteed that the library will really
  279.                 read AbsExecBase from location four, dependent on
  280.                 some internals, it might give you a cached copy
  281.                 instead. This means usually no problem since
  282.                 AbsExecBase must not change while the machine is
  283.                 up and running. 
  284.  
  285.                 This option defaults to TRUE.
  286.  
  287.                 For more quirks about the zeropage, read the
  288.                 MCXTAG_ZEROBASE tag documentation below.
  289.  
  290.     MCXTAG_BLANKFILL  - defines a ULONG word fill value for blank
  291.                 memory regions.
  292.             
  293.                 This ULONG is read by the CPU in case a program
  294.                 tries an access to "empty" memory regions. It
  295.                 defaults to 0L, but other values might be use-
  296.                 ful for debugging.
  297.  
  298.     MCXTAG_MEMORYATTRS- An exec memory attributes specifier to be used
  299.                 for allocating memory for the (hardware) MMU
  300.                 tables. Defaults to MEMF_PUBLIC, check 
  301.                 exec/memory.h for other possibilities.
  302.  
  303.     MCXTAG_PRIVATESUPER A boolean value, either TRUE or FALSE. If TRUE,
  304.                 build a private MMU supervisor table for this
  305.                 context, independent of the default supervisor
  306.                 Context. BE WARNED! This means specifically that
  307.                 possible modifications of the default supervisor
  308.                 context will not be carried over to your private
  309.                 supervisor table.
  310.                 Even if you pass in FALSE here, the library might
  311.                 still ignore your choice and build a private
  312.                 supervisor table anyways. This happens if the
  313.                 table layout you've chosen is different to the
  314.                 default table layout, making the user tree in-
  315.                 compatible to the default supervisor tree.
  316.                 
  317.     MCXTAG_ZEROBASE   - This option takes only effect if MCXTAG_EXECBASE
  318.                 is TRUE and the first page of the MMU table is
  319.                 invalid. This means that the MMU library will
  320.                 emulate accesses to valid memory in the first page
  321.                 which remains unavailable to implement an 
  322.                 "Enforcer" function. This tag provides a base 
  323.                 address to be used by the emulation as physical
  324.                 base address.
  325.                 This tag defaults to NULL meaning that the 
  326.                 library will redirect accesses to the true 
  327.                 zeropage, making it available temporarely, but
  328.                 any other memory location - provided it is page 
  329.                 aligned - can be specified here as well. This
  330.                 is important if the zero page gets remapped to
  331.                 a different location, and an Enforcer type 
  332.                 program is run later on. The zero page remapper
  333.                 should specify this tag to redirect accesses 
  334.                 transparently, even if an Enforcer type 
  335.                 application invalidates the zero page. Failing
  336.                 to do so would make the MMU library emulating
  337.                 the access to the incorrect, non-remapped memory 
  338.                 location. Since other programs might want to
  339.                 build a private MMU table with a different
  340.                 table size, it is *NOT* enough to align the
  341.                 remap destination of the zeropage to GetPageSize()
  342.                 boundaries, RemapSize() alignment is required!
  343.                 THIS IS AN ADVANCED FEATURE.
  344.  
  345.     MCXTAG_DISCACHEDES  A boolean tag item. If set to TRUE, the memory
  346.                 that keeps the descriptors is cache-inhibited.
  347.                 This works around some problems that appear if a
  348.                 program attempts to hack on the MMU itself. The
  349.                 mmu.library code has no problems with descriptors
  350.                 in non-cacheable memory. Note, however, that the
  351.                 memory will be only non-cacheable "as seen" from
  352.                 the context itself. It will *NOT* change the
  353.                 cache mode as seen from other contexts, even from
  354.                 the supervisor Context of the given Context. 
  355.  
  356.                 *HACKING THE MMU TABLES IS ILLEGAL*
  357.  
  358.     MCXTAG_LOWMEMORYLIMIT  Define a boundary in the zero page such that 
  359.                 accesses to addresses higher than this boundary 
  360.                 will be emulated in software. This is mainly for
  361.                 68060/68040 support under Os V37 and V38 where
  362.                 chip memory started at 0x400 inside the zero page.
  363.                 (NEW for V42)
  364.                 The MuLib checks the chip memory base address on
  365.                 startup and provides a useful default.
  366.  
  367.  
  368.     The next tag items define the MMU table layout. A logical address,
  369.     used as input for the MMU, consists of exactly 32 bits. These
  370.     bits are now split from the left to the right into groups to define
  371.     a "path" in the MMU tree. Each "level" of the MMU tree should be
  372.     considered as an array of pointers, pointing to the next lower
  373.     level of the tree. The nodes of the tree are contain the descriptors
  374.     that define how the address belonging to the path from the root to
  375.     this descriptor should be handled. For example, consider a three-
  376.     level tree with 7 bits for level A and B, 6 bits for level C and
  377.     12 bits for the page. The address 0x01feabcd would be used like this
  378.     to find an descriptor:
  379.  
  380.     hex 0x01feabcd is binary
  381.     
  382.     ----7--- ----7---- ---6--- ------12-------  bits 
  383.     0000 000|1 1111 11|10 1010| 1011 1100 1101
  384.     \_______/\________/\______/\_____________/
  385.         |    |    |       |
  386.         |    |    |       |
  387.         V    |    |       |
  388.     Index into level A of the MMU tree is 0, hence the first pointer
  389.     is read. The MMU obtains now another array of pointers, called
  390.     the level B.     |       |
  391.         |    |       |
  392.         V    |       |
  393.         Index into level B of the MMU tree is 127. The MMU uses
  394.         the last pointer from the table obtained in the previous
  395.         step.    |       |
  396.             |       |
  397.             V       |
  398.             Index into level C of the MMU tree is 42. The MMU
  399.             uses, hence, the 42nd pointer of the array pointed
  400.             to by the 127th pointer of the level B array. This
  401.             is now the "page descriptor", defining the base
  402.             address for the next step.
  403.                    |
  404.                    |
  405.                    V
  406.     This is now finally the page offset, 0xbcd in this example. It
  407.     is added to the base address from the page descriptor in level C.
  408.     If the address is not "remapped", the base address would be
  409.     identically to the first 32-12 = 20 bits of the physically address.
  410.     
  411.  
  412.     MCXTAG_DEPTH      - Depth of the MMU tree to build. Defaults to
  413.                 the depth of the global public context.
  414.  
  415.                 Legal values are 1..4 for the 68020/68851 and
  416.                 the 68030, but the 68040/68060 supports only
  417.                 trees of depth 3.
  418.  
  419.     MCXTAG_LEVELABITS - Number of bits of the logical address that make
  420.                 up the level A of the MMU tree. 2^bits is the
  421.                 number of entries on this level of the tree.
  422.  
  423.                 The 68020/68851 and the 68030 support here
  424.                 values from 1..15, the only legal value for
  425.                 the 68040 and 68060 is 7. 
  426.  
  427.                 The MMU library will pick a reasonable and
  428.                 system dependent default for you if you don't
  429.                 specify this tag item.
  430.  
  431.     MCXTAG_LEVELBBITS - Number of bits for the level B of the MMU tree,
  432.                 unused if the depth is smaller than two.
  433.  
  434.                 Legal values are 1..15 for the 851 and 030, and
  435.                 7 as only possible value for the 040 and 060.
  436.  
  437.     MCXTAG_LEVELCBITS - Number of bits of the level C of the MMU tree,
  438.                 unused if the depth is smaller than three.
  439.  
  440.                 Arguments may range from 1..15 for the 851 and
  441.                 030, and must be either 5 or 6 for the 040 and
  442.                 060.
  443.  
  444.     MCXTAG_LEVELDBITS - Number of bits in the level D of the MMU tree,
  445.                 only used if the depth is four and therefore
  446.                 unused on the 040 and 060. 
  447.  
  448.                 Must range from 1..15.
  449.  
  450.     MCXTAG_PAGEBITS   - Number of bits to be used from the logical
  451.                 address as the page offset. 2^bits is the
  452.                 page size. 
  453.  
  454.                 Legal values are 8..15, giving 256 bytes up
  455.                 to 32K pages for the 68020/68851 and 68030, or
  456.                 12..13 defining 4K resp. 8K pages for the
  457.                 68040 and 68060. 
  458.  
  459.                 The default is the page size of the global 
  460.                 context.
  461.  
  462.     All the "..."BITS specifications MUST sum up to 32 since a logical
  463.     address consists of exactly 32 bits. You may leave out some or all 
  464.     of these tags, the MMU library will keep care of the rest and will
  465.     chose reasonable defaults for you.
  466.  
  467.  
  468.     MCXTAG_ERRORCODE -  pointer to a ULONG the MMU library will fill
  469.                 in with an error code in case building the
  470.                 MMU tree failed. It will be set to 0L if the
  471.                 function succeeds. The following error codes
  472.                 have been defined:
  473.  
  474.         CCERR_NO_FREE_STORE         -  the library went out of memory.
  475.         CCERR_INVALID_PARAMETERS -  the parameters specified by the 
  476.                     tags are invalid.
  477.         CCERR_UNSUPPORTED         -    the parameters are valid, but 
  478.                     not supported by the hardware.
  479.         CCERR_TRIMMED            -    the library performed some minor
  480.                     adjustments on the MMU table passed
  481.                     in for cloning. The cache modes
  482.                     might not be optimal due to some
  483.                     roudings that have to be performed,
  484.                     but the MMU table should work in
  485.                     general.
  486.  
  487.                     THIS IS NOT AN ERROR, you will get
  488.                     your new context.
  489.  
  490.         CCERR_UNALIGNED         -    the library had to perform heavy
  491.                     rouding in the MMU table passed
  492.                     in, it might be unusable. For 
  493.                     example, remapped pages were mis-
  494.                     aligned and due to the rounding
  495.                     accesses might go to wrong 
  496.                     locations. If you get this return
  497.                     code, you should possibly deallocate
  498.                     the new context and inform the user
  499.                     that the request could not be satis-
  500.                     fied.
  501.  
  502.                     Still, THIS IS NOT AN ERROR. You
  503.                     get a new context, but possibly an
  504.                     usuable one.
  505.  
  506.     RETURNS
  507.     NULL if the new context couldn't be created or a handle to the
  508.     new context, as parameter to all MMU library functions.
  509.  
  510.     NOTES
  511.     This call makes NOT the current task entering the new context,
  512.     you've to call EnterMMUContext() explicitly for that purpose.
  513.  
  514.     The context structure is not documented intentionally. It depends
  515.     on the implementation.
  516.  
  517.     BUGS
  518.  
  519.     SEE ALSO
  520.     DeleteMMUContext()
  521.  
  522.     BUGS
  523.  
  524. mmu.library/DeleteMMUContext           mmu.library/DeleteMMUContext
  525.     
  526.     NAME
  527.     DeleteMMUContext - delete an MMU context build with CreateMMUContext.
  528.  
  529.     SYNOPSIS
  530.     DeleteMMUContext ( context );
  531.                 a0
  532.  
  533.     void DeleteMMUContext ( struct MMUContext * );
  534.  
  535.     FUNCTION
  536.     This function deletes a context build with CreateMMUContext().
  537.  
  538.  
  539.     INPUTS   
  540.     A handle to the context to be deleted.
  541.  
  542.     RETURNS
  543.     nothing.
  544.  
  545.     NOTES
  546.     This call doesn't remove any task from the context, especially the
  547.     current task is NOT removed from the context. You've to call
  548.     LeaveMMUContext() before.
  549.  
  550.     Deleting a context with some tasks still in this context will
  551.     cause this function to guru.
  552.  
  553.     If your context was created with a private supervisor context
  554.     included, you must call this function only *once*, with the
  555.     user context created. It will automatically deallocate the
  556.     attached supervisor context as well.
  557.  
  558.     BUGS
  559.  
  560.     SEE ALSO
  561.     CreateMMUContext()
  562.  
  563. mmu.library/EnterMMUContext            mmu.library/EnterMMUContext
  564.  
  565.     NAME
  566.     EnterMMUContext - let a task enter a specific context.
  567.  
  568.     SYNOPSIS
  569.     context = EnterMMUContext( context , task );
  570.     d0                 a0       a1
  571.  
  572.     struct MMUContext * EnterMMUContext( struct MMUContext * , 
  573.                          struct Task * );
  574.  
  575.     FUNCTION
  576.     Add a given task to a context. This makes the MMU settings defined
  577.     by the context available for the task in question.
  578.  
  579.     INPUTS
  580.     context - the context to enter or NULL for the global context.
  581.     task    - a pointer to the task structure that should enter the
  582.           context.
  583.  
  584.     RETURNS
  585.     a handle to the context the task participated before or NULL if
  586.     this function failed. The task will stay in the last context used
  587.     in this case.
  588.  
  589.     NOTES
  590.     This call uses the tc_Switch() and tc_Launch() functions of the
  591.     task structure. What basically happens here is that these functions
  592.     are set to internal procedures that swap the context specific
  593.     MMU table or the global MMU in and flush the ATC of the MMU.
  594.  
  595.     This call may fail, check the return code for NULL - either due to
  596.     lack of memory or because the task is part of a protected context
  597.     the current task hasn't entered.
  598.  
  599.     If you want to use the tc_Switch() and tc_Launch() functions your-
  600.     self, you should install a task specific context hook, see 
  601.     AddContextHook().
  602.  
  603.     This function can be used to change the context of a task by
  604.     adding it to a new context. The task specific context switch and
  605.     launch hooks will be "carried over" to the new context, but all
  606.     other MMU specific exceptions are now the matter of the new context.
  607.  
  608.     BUGS
  609.  
  610.     SEE ALSO
  611.     LeaveMMUContext(), exec/tasks.h
  612.  
  613. mmu.library/LeaveMMUContext            mmu.library/LeaveMMUContext
  614.     
  615.     NAME
  616.     LeaveMMUContext - remove a given task from a context.
  617.  
  618.     SYNOPSIS
  619.     context = LeaveMMUContext( task );
  620.     d0              a1
  621.  
  622.     struct MMUContext * LeaveMMUContext( struct Task *);
  623.  
  624.     FUNCTION
  625.     The specified task leaves its context and enters the global context.
  626.  
  627.     INPUTS
  628.     task - the task that should leave a private context and enter the
  629.         global default context.
  630.  
  631.     RETURNS
  632.     the context the task was added to or NULL on failure.
  633.     Might be the global default context if the task did not enter any 
  634.     context.
  635.  
  636.     NOTES
  637.     It is safe to call this function even if the task wasn't added to
  638.     any context. The function returns the global context in this case.
  639.  
  640.     This function must be called to any task participating a given
  641.     context to be able to delete that context.
  642.  
  643.     This function is equivalent to EnterMMUContext(NULL,task). 
  644.  
  645.     This function makes use of the tc_Switch() and tc_Launch() functions
  646.     of the task structure to be able to set the MMU root pointer.
  647.  
  648.     Make sure that you check for failure. This call may return NULL if
  649.     the task entered a protected context the current task does not
  650.     participate or if switch and launch exceptions are in use.
  651.  
  652.     BUGS
  653.  
  654.     SEE ALSO
  655.     EnterMMUContext(), DeleteMMUContext(),  
  656.     RemContextHook(), exec/tasks.h
  657.  
  658. mmu.library/CurrentContext             mmu.library/CurrentContext
  659.  
  660.     NAME
  661.     CurrentContext - find out the current context of a task.
  662.  
  663.     SYNOPSIS
  664.     context = CurrentContext( task );
  665.     d0               a1
  666.  
  667.     struct MMUContext * CurrentContext( struct Task * );
  668.  
  669.     FUNCTION
  670.     This function is used to get a handle to the context the given
  671.     task is added to, or to return the context of the calling task.
  672.  
  673.     INPUTS
  674.     task - the address of the task structure you like to investigate
  675.     or NULL to get a handle to the currently active context.
  676.  
  677.     RETURNS
  678.     a handle to the context the given task is added to, the global
  679.     context if the task is not attached to any context or the
  680.     currently active context if the argument is NULL. 
  681.  
  682.     NOTES
  683.     This call fails only if the given task is part of a protected
  684.     context which is not shared by the current task. The NULL
  685.     argument is always safe.
  686.  
  687.     BUGS
  688.  
  689.     SEE ALSO
  690.     FindTask()
  691.  
  692. mmu.library/AddContextHook             mmu.library/AddContextHook
  693.  
  694.     NAME
  695.     AddContextHook - set an exception handler to a Context
  696.  
  697.     SYNOPSIS
  698.     hook = AddContextHookA ( tags );
  699.                   a0
  700.  
  701.     hook = AddContextHook ( tag1, ... );
  702.  
  703.     
  704.     struct ExceptionHook * AddContextHookA ( struct TagItem * );
  705.  
  706.     struct ExceptionHook * AddContextHook ( Tag tag1, ... );
  707.  
  708.     FUNCTION
  709.     This call installs an exception hook for a given context for
  710.     various exception types the MMU library can provide.
  711.  
  712.     INPUTS
  713.     tags    -   A taglist defining the type of the exception hook
  714.             to be added.
  715.  
  716.     Currently defined are:
  717.  
  718.     MADTAG_CONTEXT  -    The context to which this exception hook
  719.                 should be added. This MUST be given for
  720.                 "swapped" handlers. If it is left blank
  721.                 or set to NULL for segmentation fault
  722.                 handlers, you define a global segmentation
  723.                 fault handler.
  724.  
  725.     MADTAG_TASK    -    If the hook should be called only if a
  726.                 specific task is running, specify a pointer
  727.                 to the task structure here. 
  728.                 Warning! Adding too many task specific
  729.                 hooks slows things down unnecessary.
  730.                 Remember that a MMU Context may hold more
  731.                 than one task.
  732.                 This MUST be given for the switch and launch
  733.                 hooks.
  734.  
  735.     MADTAG_TYPE    -    Type of the exception hook to build. The
  736.                 following types are available:
  737.  
  738.         MMUEH_SEGFAULT  -    Called on segmentation fault, i.e. write to
  739.                 a write protected page or access of an
  740.                 invalid page. Most useful for "Enforcer"
  741.                 like tools.
  742.  
  743.     MMUEH_SWAPPED   -    Called on access for a "swapped out" page.
  744.                 Most useful to implement virtual memory.
  745.  
  746.     MMUEH_SWITCH    -    Called when the task looses the CPU.
  747.     MMUEH_LAUNCH    -    Called when the task gains the CPU.
  748.                 Remember that the tc_Switch() and tc_Launch()
  749.                 function pointers are no longer available
  750.                 if the task has been added to a MMUContext.
  751.  
  752.     MMUEH_PAGEACCESS -    Called whenever a MAPP_SINGLE page gets
  753.                 build by the context. This could be used to
  754.                 modify the MMU tree "on the fly" if 
  755.                 necessary, the required parameters are passed
  756.                 thru.
  757.  
  758.     MADTAG_CODE     -    A function pointer to the code to be called.
  759.                 This should be an assembly language function.
  760.                 It is called like this:
  761.  
  762.     Register a0     -    Pointer to the ExceptionData structure or
  763.                 the PageAccessData.
  764.     Register a1     -    loaded with the MADTAG_DATA provided data.
  765.     Register a4     -    Ditto.
  766.     Register a5     -    Pointer to the code itself.
  767.     Register a6     -    MMUBase. NOT A SCRATCH.
  768.  
  769.     Registers d0-d1/a0-a1/a4-a5 are scratches and are available for the
  770.     Exception handler. You *MUST* set the "Z" condition code and
  771.     clear d0 on exit in case you handled the exception. Details on
  772.     how to write an exception handler are in the "Exception.doc" file.
  773.  
  774.     MADTAG_DATA    -      Data to be loaded for the hook function.
  775.     MADTAG_NAME    -    A name for the hook. Currently unused.
  776.     MADTAG_PRI    -    A priority, ranging from -128...+127.
  777.                 Hooks of higher priorities are called first.
  778.  
  779.     RESULTS
  780.     A handle to the exception hook. Do not interpret this handle.
  781.     Or NULL on failure.
  782.  
  783.     NOTES
  784.     this call will be used by the high-level function AddMessageHook().
  785.     The global segmentation fault hook may be set by a debugging tool 
  786.     like the enforcer.
  787.  
  788.     The exception will not be activated, you need to call 
  789.     ActivateException() explicitly to make the library call it.
  790.  
  791.     Much more needs to be said about this function, see Exception.doc
  792.     for details about the exception handlers.
  793.  
  794.     BUGS
  795.  
  796.     SEE ALSO
  797.     RemContextHook(), AddMessageHook(), ActivateException(),
  798.     exec/interrupts.h, Exception.doc
  799.  
  800. mmu.library/RemContextHook             mmu.library/RemContextHook
  801.  
  802.     NAME
  803.     RemContextHook - remove an exception handler from a Context
  804.  
  805.     SYNOPSIS
  806.     RemContextHook( hook )
  807.              a1
  808.  
  809.     void RemContextHook( struct ExceptionHook * );
  810.  
  811.     FUNCTION
  812.     This function removes a previously installed context hook
  813.     from the hook list.
  814.  
  815.     INPUTS
  816.     The handle of the hook, as obtained by AddContextHook().
  817.  
  818.     RESULTS
  819.     none.
  820.  
  821.     NOTES
  822.     You must call DeactivateException() on your hook before you
  823.     remove it.
  824.     Be aware that the library will call the exec exception handler,
  825.     i.e. will generate a guru in case no exception handler is
  826.     available.
  827.  
  828.     SEE ALSO
  829.     AddContextHook(), DeactivateException(), exec/interrupts.h
  830. mmu.library/AddMessageHook             mmu.library/AddMessageHook
  831.  
  832.     NAME
  833.     AddMessageHook - install a high-level hook function.
  834.  
  835.     SYNOPSIS
  836.     hook = AddMessageHookA ( tags );
  837.                   a0
  838.  
  839.     hook = AddMessageHook ( tag1, ... );
  840.  
  841.  
  842.     struct ExceptionHook * AddMessageHookA ( struct TagItem * );
  843.  
  844.     struct ExceptionHook * AddMessageHook ( Tag tag1, ... );
  845.  
  846.     FUNCTION
  847.     Installs a high-level hook of the tag-given properties.
  848.     As soon as an exception of the requested type occurs, an exception 
  849.     message (see below) will be sent to the port. The task that caused 
  850.     the exception will be halted until the message gets replied.
  851.     BE WARNED: Message hooks perform only operation if task switching
  852.     is enabled and interrupts are allowed and the code failed in
  853.     User mode. They will just "drop thru" to the next handler if this 
  854.     is not the case.
  855.  
  856.     INPUTS
  857.     tags    -   A taglist defining the type of the exception hook
  858.             to be added.
  859.  
  860.     Currently defined are:
  861.  
  862.     MADTAG_CONTEXT   -    The context to which this exception hook
  863.                 should be added. This MUST be given.
  864.  
  865.     MADTAG_TASK     -    If the hook should be called only if a
  866.                 specific task is running, specify a pointer
  867.                 to the task structure here. 
  868.                 Warning! Adding too many task specific
  869.                 hooks slows things down unnecessary.
  870.                 Remember that a MMU Context may hold more
  871.                 than one task.
  872.  
  873.     MADTAG_TYPE     -    Type of the exception hook to build. The
  874.                 following types are available:
  875.  
  876.     MMUEH_SEGFAULT   -    Called on segmentation fault, i.e. write to
  877.                 a write protected page or access of an
  878.                 invalid page. Most useful for "Enforcer"
  879.                 like tools.
  880.  
  881.         MMUEH_SWAPPED    -    Called on access for a "swapped out" page.
  882.                 Most useful to implement virtual memory.
  883.  
  884.     MADTAG_CATCHERPORT  -   The port to sent the data to.
  885.     MADTAG_NAME        -    A name for the hook. Currently unused.
  886.     MADTAG_PRI        -    A priority, ranging from -128...+127.
  887.                 Hooks of higher priorities are called first.
  888.  
  889.     On an exception, the following message will be sent to the port:
  890.  
  891.     struct ExceptionMessage {
  892.         struct Message        exm_msg;
  893.         struct ExceptionData    exm_Data;
  894.     };
  895.  
  896.     For details about the ExceptionData structure, see Exception.doc.
  897.  
  898.     Once the message gets replied, the faulted task is restarted.
  899.  
  900.     RESULTS
  901.     a handle for the exception that must be passed back to 
  902.     RemMessageHook() for removal or NULL on failure.
  903.     Do not interpret this handle.
  904.     
  905.     NOTES
  906.     The handler must have been added to a context with EnterMMUContext()
  907.     before this function can be used. Unlike the AddContextHook() 
  908.     function, this DOES NOT work for "plain" tasks without a context.
  909.  
  910.     The hook must be activated with ActivateException() before it 
  911.     gets called.
  912.  
  913.     This function is used by the memory.library to install its
  914.     exception handler. The port will be in this case the port of
  915.     the swapper daemon that loads swapped out pages from disk.
  916.  
  917.     BUGS
  918.     
  919.     SEE ALSO
  920.     AddContextHook(), RemContextHook(), RemMessageHook(), 
  921.     ActivateException(), Exception.doc
  922.  
  923. mmu.library/RemMessageHook             mmu.library/RemMessageHook
  924.  
  925.     NAME
  926.     RemMessageHook  -   remove a high-level hook from a context.
  927.  
  928.     SYNOPSIS
  929.     RemMessageHook( handle );
  930.              a1
  931.  
  932.     void RemMessageHook( struct ExceptionHook * );
  933.  
  934.  
  935.     FUNCTION
  936.     This function removed a previously installed Message hook from
  937.     the hook list of the context.
  938.  
  939.     INPUTS
  940.     handle - a handle to the message hook as returned by the 
  941.         AddMessageHook function.
  942.  
  943.     RESULTS
  944.     none.
  945.  
  946.     NOTES
  947.     To remove a message hook safely, deactivate it first with
  948.     DeactivateException(), then tell the daemon to reply all 
  949.     exceptions of this hook, then remove it. 
  950.  
  951.     Not following these rules may cause deadlocks.
  952.     
  953.     BUGS
  954.     
  955.     SEE ALSO
  956.     AddMessageHook(), AddContextHook(), RemContextHook(),
  957.     DeactivateException(), Exception.doc
  958.  
  959. mmu.library/ActivateException          mmu.library/ActivateException
  960.  
  961.     NAME
  962.     ActivateException   -   enable an exception hook.
  963.  
  964.     SYNOPSIS
  965.     ActivateException( hook );
  966.                 a1
  967.  
  968.     void ActivateException( struct ExceptionHook * );
  969.  
  970.     FUNCTION
  971.     Activates a formerly installed exception hook, either a low
  972.     level context hook or a high-level message hook.
  973.     
  974.     RETURNS
  975.     
  976.     NOTES
  977.     Hooks of either kind must be activated before the mmu.library
  978.     will call them. Hooks are deactivated after creation and must
  979.     be deactivated before they get removed.
  980.     This call can be safely used within interrupts and from super-
  981.     visor mode.
  982.  
  983.     BUGS
  984.  
  985.     SEE ALSO
  986.     DeactivateException(), AddContextHook(), AddMessageHook(),
  987.     Exception.doc
  988.  
  989. mmu.library/DeactivateException        mmu.library/DeactivateException
  990.  
  991.     NAME
  992.     DeactivateException -   enable an exception hook.
  993.  
  994.     SYNOPSIS
  995.     DeactivateException( hook );
  996.                   a1
  997.  
  998.     void DeactivateException( struct ExceptionHook * );
  999.  
  1000.     FUNCTION
  1001.     Deactivates a formerly installed exception hook, either a low
  1002.     level context hook or a high-level message hook, i.e. disables
  1003.     it from being called.
  1004.     
  1005.     RETURNS
  1006.     
  1007.     NOTES
  1008.     Hooks of either kind must be activated before the mmu.library
  1009.     will call them. Hooks are deactivated after creation and must
  1010.     be deactivated before they get removed.
  1011.     This call can be safely used within interrupts and from super-
  1012.     visor mode.
  1013.  
  1014.     BUGS
  1015.  
  1016.     SEE ALSO
  1017.     ActivateException(), RemContextHook(), RemMessageHook(),
  1018.     Exception.doc
  1019.  
  1020. mmu.library/GetPageSize                mmu.library/GetPageSize
  1021.  
  1022.     NAME
  1023.     GetPageSize - return the page size of a context.
  1024.  
  1025.     SYNOPSIS
  1026.     pagesz = GetPageSize( context );
  1027.     d0            a0
  1028.  
  1029.     ULONG GetPageSize( struct MMUContext * );
  1030.  
  1031.     FUNCTION
  1032.     This function returns the page size selected by the MMU library for
  1033.     the given context. Possible page sizes are limited by the hardware
  1034.     and cannot be adjusted from the outside. The page size is set up
  1035.     by the MMU library for the global public context, and it can be
  1036.     selected from the available page sizes for private MMUContexts, see
  1037.     CreateMMUContext().
  1038.  
  1039.     INPUTS
  1040.     context - a handle to the context to be investigated or NULL for
  1041.         the active context.
  1042.  
  1043.     RESULTS
  1044.     the page size in bytes or zero for failure.
  1045.  
  1046.     NOTES
  1047.  
  1048.     BUGS
  1049.  
  1050.     SEE ALSO
  1051.     CreateMMUContext()
  1052.  
  1053. mmu.library/RemapSize                  mmu.library/RemapSize
  1054.  
  1055.     NAME
  1056.     RemapSize - return the block size for memory remapping.
  1057.  
  1058.     SYNOPSIS
  1059.     remapsize = RemapSize( context );
  1060.     d0             a0
  1061.  
  1062.     ULONG RemapSize( struct MMUContext * );
  1063.  
  1064.     FUNCTION
  1065.     This function returns the smallest possible block size, and
  1066.     therefore the alignment restrictions, for remapping of memory that
  1067.     should be added to the exec memory pool. Since the MMU tables have
  1068.     to be placed in non-fragmented memory, certain alignment 
  1069.     restrictions for the memory blocks the MMU tables are placed in
  1070.     arise. 
  1071.     This harder aligment condition is only required for memory
  1072.     that is put into the exec free list, but as long as remapped
  1073.     memory is never returned from AllocMem, the page size is good 
  1074.     enough.
  1075.  
  1076.     INPUTS
  1077.     context - a handle to the context to be investigated or NULL for
  1078.         the active context.
  1079.  
  1080.     RESULTS
  1081.     the smallest admissable block size for memory returned by 
  1082.     AllocMem().
  1083.  
  1084.     NOTES
  1085.     The call will fail if the given context is protected, the result
  1086.     will be zero in this case.
  1087.  
  1088.     Even though the mmu.library does support memory remapping, this
  1089.     does not mean all other programs do. For example, remember that
  1090.     the inputs to the "MAPP_REMAPPED" pages is a physical page size,
  1091.     hence your program has to translate the logical address obtained
  1092.     by AllocMem() to a physical address at first. This can be done 
  1093.     with the PhysicalLocation() function.
  1094.     
  1095.     Additionally, DMA devices might or might not support memory
  1096.     remapping, just for the same reason: They require physical, not
  1097.     logical addresses. The MMU library provides a translation mechanism
  1098.     in form of the ChachePreDMA() and CachePostDMA() functions of
  1099.     ExecBase, but not all DMA device drivers call these functions
  1100.     properly. Certain patches might be made available for devices
  1101.     not following this rule.
  1102.  
  1103.     BUGS
  1104.     Adding remapped memory to the freelist is highly untested and
  1105.     not recommended because of the quirks of this mechanism.
  1106.  
  1107.     SEE ALSO
  1108.     PhysicalLocation(), GetPageSize(), exec/CachePreDMA(),
  1109.     DMAInitiate()
  1110.  
  1111. mmu.library/SetProperties             mmu.library/SetProperties
  1112.  
  1113.     
  1114.     NAME
  1115.     SetProperties - set memory attributes for a given logical range.
  1116.  
  1117.     SYNOPSIS
  1118.  
  1119.     result = SetPropertiesA( context, flags, mask, lower, size, tags);
  1120.     d0                a0      d1    d2     a1    d0    a2
  1121.  
  1122.     BOOL SetPropertiesA( struct MMUContext *, ULONG, ULONG, ULONG, ULONG,
  1123.                  struct TagItem *);
  1124.  
  1125.  
  1126.     result = SetProperties( context, flags, mask, lower, size, tag1, ...);
  1127.  
  1128.     BOOL SetProperties( struct MMUContext *, ULONG, ULONG, ULONG, ULONG,
  1129.                 Tag tag1, ...);
  1130.  
  1131.     FUNCTION
  1132.     This call sets attributes of a certain memory range of the
  1133.     software abstraction layer of the MMU tree, aligned to page 
  1134.     boundaries.
  1135.  
  1136.     INPUTS
  1137.     context - a handle to the context to modify or NULL for the active
  1138.         context.
  1139.  
  1140.     flags   - a binary flags field for the attributes to define. The
  1141.         following bits have been defined:
  1142.  
  1143.         MAPP_WRITEPROTECTED  -  The page will be write 
  1144.             protected. Writes to this area will cause a segmentation
  1145.             fault.
  1146.  
  1147.         MAPP_ROM         - Read only memory, writes tolerated.
  1148.             This is almost identically to MAPP_WRITEPROTECTED except
  1149.             that writes into this area will not cause a call of the
  1150.             segmentation fault handler. The library will filter them
  1151.             out.
  1152.             This property can be used to simulate a ROM in RAM and
  1153.             might be useful for kickstart remappers.
  1154.  
  1155.         MAPP_USED         -   The "used" bit of the pages
  1156.             will be set. The CPU will set this bit automatically
  1157.             as soon as the pages are accessed.
  1158.  
  1159.             This flag will turn on the "USED" bit in the hard-
  1160.             ware MMU bit. NOT setting this flag means that the
  1161.             USED bit in the hardware tree is preserved, regard-
  1162.             less of the mask value.
  1163.  
  1164.         MAPP_MODIFIED         -   The "modified" bit of the pages
  1165.             will be set. The CPU will set this bit automatically
  1166.             as soon as a write is performed to the page in question.
  1167.             DO NOT SET THIS BIT TOGETHER WITH MAPP_WRITEPROTECTED
  1168.             OR WITHOUT MAPP_USED or the CPU might hang. 
  1169.  
  1170.             This flag will turn on the "MODIFIED" bit in the hard-
  1171.             ware MMU bit. NOT setting this flag means that the
  1172.             MODIFIED bit in the hardware tree is preserved, regard-
  1173.             less of the mask value.
  1174.  
  1175.         MAPP_PRIVATE         -   The page will be marked invalid
  1176.             for all but the given contexts.
  1177.  
  1178.         MAPP_INVALID         -   The page will be marked as 
  1179.             invalid. Accessing it will invoke the bus error hook.
  1180.             User data can be provided for this property mode,
  1181.             provided you don't select MAPP_SINGLEPAGE or 
  1182.             MAPP_REPAIRABLE as well.
  1183.  
  1184.         MAPP_SWAPPED         -   The page will be marked as
  1185.             swapped out.
  1186.             A block ID *MUST* be provided for this property mode.
  1187.  
  1188.         MAPP_CACHEINHIBIT    -   The page will be marked as non-
  1189.             cacheable.
  1190.  
  1191.         MAPP_IMPRECISEEXECPTION -   The page will be marked as 
  1192.             "imprecise exception". MAPP_CACHEINHIBIT is mandatory
  1193.             in this case or this flag does nothing.
  1194.             Only available for the 68060, but does not harm for
  1195.             other MMUs.
  1196.  
  1197.         MAPP_NONSERIALIZED   -   The page will be marked as
  1198.             serialized. MAPP_CACHEINHIBIT is mandatory if this
  1199.             property is selected. 
  1200.             Only available for the 68040, but does not harm for
  1201.             other MMUs.
  1202.  
  1203.         MAPP_COPYBACK         -   The page will be marked as
  1204.             "copyback" instead of "writethrough". Generally re-
  1205.             commended since this is faster for the '40 and '60.
  1206.             Only available for 68040 and 68060, but does not harm
  1207.             if selected for other MMUs. MAPP_CACHINHIBIT MUST NOT
  1208.             be selected.
  1209.     
  1210.         MAPP_REMAPPED         -   Map the page to a different
  1211.             memory location. Parameters are given in the tag items.
  1212.  
  1213.             Even though this seems simple, remapping memory is
  1214.             full of quirks. Obviously, DMA devices and the MMU
  1215.             itself see the true physical addresses and not the
  1216.             logical addresses as filtered by the MMU. Therefore,
  1217.             adding remapped memory to the exec.library freelist
  1218.             will cause nothing than trouble and hard to trace
  1219.             disk faults and crashes as soon as this memory is
  1220.             used by a DMA device or the mmu.library itself.
  1221.             (Note that even though the library is supposed to
  1222.              support this, this is currently untested)
  1223.             Even though there *are* documented methods how to
  1224.             prepare a DMA transfer for remapped memory, USING
  1225.             these exec function calls is unfortunately the 
  1226.             exceptions. Therefore, this method is currently un-
  1227.             supported, by most (!really!) DMA device drivers. 
  1228.             Amongst the broken devices are the gvpscsi.device 
  1229.             and the cybscsi.device, to give just two examples.
  1230.  
  1231.             The omniscsi.device (the "Guru ROM") can be fixed
  1232.             with the MuOmniScsiPatch.
  1233.  
  1234.             If you really *MUST* remap public memory, then align
  1235.             it *AT LEAST* to the border given by RemapSize().   
  1236.             Just page alignment WILL NOT BE ENOUGH due to the way
  1237.             how the library works internally.   
  1238.  
  1239.             YOU HAVE BEEN WARNED!
  1240.             
  1241.         MAPP_SUPERVISORONLY  -   The page will be not available
  1242.             for user programs.
  1243.  
  1244.             NOTE: This mode is currently implemented using invalid 
  1245.             page descriptors for the user pages and is ignored
  1246.             when building supervisor tables. This method saves some
  1247.             space for the 68040 and 68060 and was the only way how
  1248.             it could be done for the 68030 and 68851 without using
  1249.             MMU tables twice as large.
  1250.  
  1251.         MAPP_USERPAGE0         -   Set user page attribute 0.
  1252.             This selects the user page attribute 0 for the 68040
  1253.             and 68060. "USER" DOES NOT MEAN YOU!
  1254.             The status of this bit appears on special pins of the
  1255.             CPU and might be required by some hardware, so don't    
  1256.             play with this. You should not change this bit, by no
  1257.             means.
  1258.  
  1259.         MAPP_USERPAGE1         -   Set user page attribute 1.
  1260.             This selects the user page attribute 0 for the 68040
  1261.             and 68060. See above for warnings.
  1262.  
  1263.         MAPP_GLOBAL         -   The pages are part of the
  1264.             global (public) memory. 
  1265.             You should not set this bit manually, it is under
  1266.             control of the library to optimize table flushes.
  1267.  
  1268.         MAPP_BLANK         -   Blank memory.
  1269.             The pages are mapped to one special area in RAM so
  1270.             erraneous reads and writes to these pages won't harm. 
  1271.             MAPP_BLANK should ONLY be used to mark special memory
  1272.             areas as "non-available" and un-handled by the hardware,
  1273.             nothing else. 
  1274.  
  1275.         MAPP_SHARED         -   Properties are identically to
  1276.             the public context.
  1277.             This tells the library to use the same properties as
  1278.             for the global context. However, MAPP_SHARED pages
  1279.             are not automatically updated when the global context
  1280.             changes, it's just a convenient way of saying "I want
  1281.             to uninstall my settings".
  1282.  
  1283.         MAPP_TRANSLATED        -   Under control of the TTx registers.
  1284.             NEVER SET THIS BIT YOURSELF.
  1285.             Pages with the "MAPP_TRANSLATED" bit set are under
  1286.             control of the "transparent translation registers" of
  1287.             the MMU and are "out of scope" for the mmu.library.
  1288.             Defining any properties for this domain will do nothing
  1289.             (or little, dependent on the TTx register configuration).
  1290.             A virtual memory program MUST NOT use virtual addresses
  1291.             which are transparently translated, this won't work.
  1292.             The mmu.library tries to be smart about the TTx registers
  1293.             and disables "unuseful" TTx settings itself.
  1294.  
  1295.         MAPP_INDIRECT         -   Map to a user provided page
  1296.             descriptor.
  1297.             The provided pages(s) are mapped by a user provided
  1298.             page descriptor. This page descriptor MUST BE aligned
  1299.             to a long word address, and it MUST BE a valid page
  1300.             descriptor for the MMU used.
  1301.  
  1302.             NEVER EVER attempt DMA, such as harddisk reads or
  1303.             writes to a memory domain marked as MAPP_INDIRECT.
  1304.  
  1305.             Due to some cache peculatities, the data might be
  1306.             incorrect and the result would be corrupt data.
  1307.  
  1308.             The library will be able to mark pages as non-cacheable
  1309.             if this is required for the DMA transfer, but this
  1310.             magic does not work for indirect pages.
  1311.  
  1312.             JUST DON'T DO THAT, MAPP_INIDIRECT is definitely an
  1313.             advanced feature.
  1314.  
  1315.         MAPP_BUNDLED         -   Map all pages in range to
  1316.             a single page in RAM.
  1317.  
  1318.             The main purpose of this function is to provide a
  1319.             MAPP_BLANK property with a user-selectable target
  1320.             page.
  1321.  
  1322.         MAPP_SINGLEPAGE         -   Make this page available for
  1323.             SetPageProperties().
  1324.  
  1325.             WARNING! Setting this bit shortcuts some optimizations
  1326.             the library might perform on the MMU table. The system
  1327.             may easely run out of memory if you select this
  1328.             property for "too many" pages. Use it with care, you
  1329.             have been warned!
  1330.  
  1331.         MAPP_REPAIRABLE         -   Inform the exception handler
  1332.             to provide write data and to allow pipeline fill.
  1333.  
  1334.             If this bit is set, the exception handler gets informed
  1335.             that you want to know the write data in case writes
  1336.             fail, or you want to provide the read data in case
  1337.             reads fail. The read/write data is available in the
  1338.             ExceptionData structure, read the exception handler
  1339.             documentation.
  1340.  
  1341.             This flag should be combined with MAPP_INVALID,
  1342.             MAPP_WRITEPROTECTED, MAPP_SWAPPED or 
  1343.             MAPP_SUPERVISORONLY
  1344.  
  1345.             However, this technique requires a lot of "trickery"
  1346.             and should be expected to be slow and to create
  1347.             sub-optimal and over-sized MMU tables. Use it with
  1348.             care, on as few pages as possible and only if your
  1349.             exception handler is "not on a hurry".
  1350.  
  1351.         MAPP_USERATTRIBUTE0  -   This is for your private use.
  1352.             This bit does not have any specific function, it is
  1353.             for your private use.
  1354.  
  1355.         MAPP_USERATTRIBUTE1  -   This is for your private use.
  1356.         MAPP_USERATTRIBUTE2
  1357.         MAPP_USERATTRIBUTE3
  1358.  
  1359.  
  1360.     mask    -   A bit mask of the attributes to be changed.
  1361.  
  1362.         Note that the hardware USED and MODIFIED bits will never
  1363.         be cleared, even though the properties say so and the
  1364.         corresponding bits in the mask are set. However, you can
  1365.         force them "ON" if you like, this saves unnecessary write-
  1366.         backs of the MMU.
  1367.     
  1368.     lower   -   The lower boundary of the logical address to be 
  1369.         modified. This must be aligned to the page size or this call
  1370.         will guru.
  1371.  
  1372.     size    -   Size of the region to be modified. Must be a multiple
  1373.         of the page size.
  1374.  
  1375.     tags    -   A tag array with additional data. Currently defined:
  1376.  
  1377.         MAPTAG_DESTINATION   -   the physical destination of the
  1378.             logical address. Must be provided for the MAPP_MAPPED
  1379.             or MAPP_BUNDLED bits. 
  1380.  
  1381.         MAPTAG_BLOCKID       -   a unique ID the MMU.library doesn't
  1382.             care about, for external usage of the memory.library.
  1383.             Must be provided for the MAPP_SWAPPED flag and may be
  1384.             used to indicate where on disk the swapped page is
  1385.             kept.
  1386.         
  1387.         MAPTAG_USERDATA      -   a unique cookie you might provide
  1388.             for MAPP_INVALID pages and which is passed thru to the
  1389.             segmentation fault exception handler.
  1390.  
  1391.         MAPTAG_DESCRIPTOR    -   a pointer to a long word aligned
  1392.             table descriptor for MAPP_INDIRECT.
  1393.         
  1394.  
  1395.     RESULTS
  1396.     A boolean success/failure indicator. Might fail if the context
  1397.     is protected or no memory is available for the modification.
  1398.  
  1399.     NOTES
  1400.     This call adjusts only the abstraction layer of the MMU table
  1401.     and marks the pages as "dirty". An explicit call to 
  1402.     RebuildTree() is required to make the changes active.
  1403.     You should bundle changes to the MMU table and call RebuildTree()
  1404.     once when you're done because rebuilding the MMU tree is a costy
  1405.     operation.
  1406.     If you need to modify the MMU table "on the fly" then consider
  1407.     using "SetPageProperties()", even though its use is restricted
  1408.     to single pages. Even faster are MAPP_INDIRECT pages, but - to
  1409.     say that again - DO NOT PERFORM DMA ON THESE PAGES.
  1410.  
  1411.     The page size can be read with GetPageSize(). 
  1412.  
  1413.     SUPERVISORONLY, SWAPPED and INVALID memory are implemented 
  1414.     using the same MMU attributes (invalid, namely), but the 
  1415.     library exception handler will filter them out and call 
  1416.     the appropriate hook.
  1417.  
  1418.     Write protection goes only for the context specified. It 
  1419.     usually makes sense to mark the memory region as PRIVATE as well, 
  1420.     unless you modify the public hook.
  1421.     (Note that MAPP_PRIVATE is currently not implemented because it
  1422.      will slow down things considerably.)
  1423.  
  1424.     You may freely mark the first memory page as INVALID provided
  1425.     the context MCXTAG_EXECBASE flag is set (it usually is).
  1426.     Long word read accesses to AbsExecBase will be filtered out by 
  1427.     the exception handler of the library and will be satisfied trans-
  1428.     parently to the program, as well as all other accesses except
  1429.     those into the first 1024 bytes.
  1430.  
  1431.     BUGS
  1432.  
  1433.     If the mask contains any property that requires user data, i.e.
  1434.     MAPP_REMAPPED or MAPP_SWAPPED, you *have* to redefine the user 
  1435.     data by tag items and MAY NOT leave them out, as the library 
  1436.     WILL NOT be able to restore the previously defined user data.
  1437.  
  1438.     SEE ALSO
  1439.     GetProperties(), AddContextHook(), GetPageSize(), 
  1440.     RemapSize(), RebuildTree(), SetPageProperties(),   
  1441.     SetMappingProperties()
  1442.  
  1443. mmu.library/SetPageProperties             mmu.library/SetPageProperties
  1444.  
  1445.     NAME
  1446.     SetPageProperties - set hardware memory attributes for a single
  1447.     page.
  1448.  
  1449.     SYNOPSIS
  1450.  
  1451.     result = SetPagePropertiesA( context, flags, mask, lower, tags);
  1452.     d0                a0    d1    d2    a1     a2
  1453.  
  1454.     BOOL SetPagePropertiesA( struct MMUContext *, ULONG, ULONG, ULONG,
  1455.                  struct TagItem *);
  1456.  
  1457.  
  1458.     result = SetPageProperties( context, flags, mask, lower, tag1, ...);
  1459.  
  1460.     BOOL SetPageProperties( struct MMUContext *, ULONG, ULONG, ULONG, 
  1461.                 Tag tag1, ...);
  1462.  
  1463.     FUNCTION
  1464.     This call sets the hardware attributes of a memory page.
  1465.  
  1466.     INPUTS
  1467.     context - a handle to the context to modify or NULL for the active
  1468.         context.
  1469.  
  1470.     flags   -   a binary flags field for the attributes to define. For
  1471.             the available attributes, see the SetProperties()
  1472.             function.
  1473.  
  1474.             Differences:
  1475.  
  1476.             MAPP_MODIFIED and MAPP_USED are really set or cleared
  1477.             in the true hardware table, the mask is considered
  1478.             correctly.
  1479.  
  1480.             Note that this function is the only method to clear
  1481.             these two hardware flags, SetProperties() or
  1482.             RebuildTree() don't do this.
  1483.  
  1484.     mask    -   a bit mask of all bits to be changed.
  1485.  
  1486.     tags    -   A tag array with additional data. Check 
  1487.             SetProperties() for details.
  1488.  
  1489.     RESULTS
  1490.     A boolean success/failure indicator. Might fail if the context
  1491.     is protected or no memory is available for the modification or
  1492.     the page is not marked with MAPP_SINGLEPAGE.
  1493.  
  1494.     NOTES
  1495.     BE WARNED! This function is very restricted in its use. It may well
  1496.     return FALSE even if all parameters are valid due to hardware 
  1497.     restrictions. This function does never ever rebuild an MMU tree,
  1498.     it just modifies "what is there". If the library choose to optimize
  1499.     the MMU library tree and to map a couple of pages by one descriptor,
  1500.     for what reasons ever, this call will fail. The details when this
  1501.     happens depends not only on the MMU, but on the general system
  1502.     layout.
  1503.  
  1504.     The ONLY documented way to get a mapping for a page that can be
  1505.     adjusted using this call is to set the page to MAPP_SINGLEPAGE using
  1506.     SetProperties() before.
  1507.  
  1508.     This call adjusts the hardware level of the MMU table if a descriptor 
  1509.     is available for a single page. It does not modify more than one
  1510.     page at once.
  1511.  
  1512.     It might happen that the library does not satisfy a request
  1513.     setting a page as "cacheable" if a DMA operation is currently in
  1514.     progress and the page must remain "nonacheable". However, the
  1515.     function will not fail in this case, but just delay the operation
  1516.     until the DMA is complete. The properties will always fall back to
  1517.     the next available option.
  1518.  
  1519.     This routine is safe to be called from within interrupts, it does
  1520.     not break any Forbid() or Disable() and is ideal for 
  1521.     quick-and-dirty repair operations within exceptions handlers,
  1522.     provided the MAPP_SINGLEPAGE flag has been set. 
  1523.  
  1524.     BUGS
  1525.     Note that MAPP_SINGLEPAGE is the flag you want here, not 
  1526.     MAPP_REPAIRABLE. That's something different!
  1527.  
  1528.     If the mask contains any property that requires user data, i.e.
  1529.     MAPP_REMAPPED or MAPP_SWAPPED, you *have* to redefine the user 
  1530.     data by tag items and MAY NOT leave them out, as the library 
  1531.     WILL NOT be able to restore the previously defined user data.
  1532.  
  1533.     SEE ALSO
  1534.         GetPageProperties(), AddContextHook(), 
  1535.         GetPageSize(), RebuildTree(), SetProperties(),
  1536.         SetMappingProperties()
  1537. mmu.library/RebuildTree                mmu.library/RebuildTree
  1538.  
  1539.     NAME    
  1540.     RebuildTree - build a MMU hardware tree from the software abstraction
  1541.     layer.
  1542.  
  1543.     SYNOPSIS
  1544.     result = RebuildTree( context );
  1545.     d0            a0
  1546.  
  1547.     BOOL RebuildTree ( struct MMUContext * );
  1548.  
  1549.     FUNCTION
  1550.     This function adjusts the MMU hardware tree to reflect the settings
  1551.     of the software abstraction layer defined with SetProperties().
  1552.  
  1553.     INPUTS
  1554.     context - a handle to the context to investigate or NULL for the
  1555.     active context.
  1556.  
  1557.     RESULTS
  1558.     a boolean success/failure indicator. TRUE if the operation was
  1559.     performed successfully.
  1560.  
  1561.     NOTES
  1562.     This is the big - and admittedly - slow one.
  1563.  
  1564.     Rebuilding the MMU tree is a relatively slow operation. The library
  1565.     tries to be smart about it and rebuilds only the pages whose
  1566.     mappings have been adjusted, but it's still a heavy beast.
  1567.  
  1568.     Properties temporarely defined with SetPageProperties() will be
  1569.     lost after the rebuild, except for the MAPP_USED and MAPP_MODIFIED
  1570.     bits.
  1571.  
  1572.     In case of failure, the hardware layer will remain valid and un-
  1573.     changed, but the context remains marked as "dirty".
  1574.  
  1575.     BE WARNED! A consistent use of the two flags is only possible
  1576.     if the pages are marked as MAPP_SINGLE. The page building algorithm
  1577.     does not guarantee consistent use of these two bits except for
  1578.     MAPP_SINGLE pages. Even though it *might* look well most the time,
  1579.     it is not documented that these two bits are kept correctly for non-
  1580.     SINGLE pages. If you need MODIFIED or USED page information, the only 
  1581.     way to get them is to mark these pages as MAPP_SINGLE. There's no 
  1582.     consistent use for these flags if early termination descriptors 
  1583.     (hence, w/o MAPP_SINGLE) are used by the library. 
  1584.  
  1585.     Even though some pages in the abstraction layer might be marked as
  1586.     un-USED or un-MODIFIED, this routine NEVER clears the hardware bits.
  1587.     It requires a call to SetPageProperties(), and hence the MAPP_SINGLE
  1588.     attribute (once again!) to do this.
  1589.  
  1590.     BUGS
  1591.     Much more should be said about this function.
  1592.  
  1593.     SEE ALSO
  1594.     SetProperties(), SetPageProperties(), GetProperties(),
  1595.     GetPageProperties(), RebuildTrees()
  1596.  
  1597. mmu.library/RebuildTrees              mmu.library/RebuildTrees
  1598.  
  1599.     NAME    
  1600.     RebuildTree - build a MMU hardware tree from the software abstraction
  1601.     layer for several contexts at once.                 (V41)
  1602.  
  1603.     SYNOPSIS
  1604.     result = RebuildTreesA( contextptrptr );
  1605.     d0                 a0
  1606.  
  1607.     result = RebuildTrees( context, context, ... );
  1608.  
  1609.  
  1610.     BOOL RebuildTreesA ( struct MMUContext ** );
  1611.  
  1612.     BOOL RebuildTrees ( struct MMUContext, ... ); 
  1613.  
  1614.     FUNCTION
  1615.     This function adjusts the MMU hardware tree to reflect the settings
  1616.     of the software abstraction layer defined with SetProperties().
  1617.  
  1618.     INPUTS
  1619.     contextptr - a pointer to a NULL terminated array of context
  1620.     handles.
  1621.  
  1622.     RESULTS
  1623.     a boolean success/failure indicator. TRUE if the operation was
  1624.     performed successfully and all context could have been rebuild.
  1625.  
  1626.     NOTES
  1627.     This is the big - and admittedly - slow one.
  1628.  
  1629.     Rebuilding the MMU tree is a relatively slow operation. The library
  1630.     tries to be smart about it and rebuilds only the pages whose
  1631.     mappings have been adjusted, but it's still a heavy beast.
  1632.  
  1633.     Properties temporarely defined with SetPageProperties() will be
  1634.     lost after the rebuild, except for the MAPP_USED and MAPP_MODIFIED
  1635.     bits.
  1636.  
  1637.     The advantage of this function is that it guarantees that all
  1638.     involved contexts remain unmodified and dirty in case one of the
  1639.     contexts cannot be rebuild. On success, it is guaranteed that all
  1640.     contexts will have been rebuild successfully.
  1641.  
  1642.     A special word has to be said about context locking here: This
  1643.     function will first call LockContextList(), and will then lock the
  1644.     individiual contexts in the order passed in. Hence, you've either
  1645.     to lock all contexts as well, and hence have to call 
  1646.     LockContextList() yourself as first step, or you must not lock any
  1647.     context of the contexts on the list. Everything else is dangerous
  1648.     and implies the risk of a deadlock.
  1649.  
  1650.     BE WARNED! A consistent use of the two flags is only possible
  1651.     if the pages are marked as MAPP_SINGLE. The page building algorithm
  1652.     does not guarantee consistent use of these two bits except for
  1653.     MAPP_SINGLE pages. Even though it *might* look well most the time,
  1654.     it is not documented that these two bits are kept correctly for non-
  1655.     SINGLE pages. If you need MODIFIED or USED page information, the only 
  1656.     way to get them is to mark these pages as MAPP_SINGLE. There's no 
  1657.     consistent use for these flags if early termination descriptors 
  1658.     (hence, w/o MAPP_SINGLE) are used by the library. 
  1659.  
  1660.     Even though some pages in the abstraction layer might be marked as
  1661.     un-USED or un-MODIFIED, this routine NEVER clears the hardware bits.
  1662.     It requires a call to SetPageProperties(), and hence the MAPP_SINGLE
  1663.     attribute (once again!) to do this.
  1664.  
  1665.     BUGS
  1666.     Much more should be said about this function.
  1667.  
  1668.     SEE ALSO
  1669.     SetProperties(), SetPageProperties(), GetProperties(),
  1670.     GetPageProperties(), RebuildTree()
  1671.  
  1672. mmu.library/GetProperties             mmu.library/GetProperties
  1673.  
  1674.     NAME
  1675.     GetProperties - read memory attributes for a given logical page
  1676.     from the MMU table abstraction layer.
  1677.  
  1678.     SYNOPSIS
  1679.  
  1680.     flags = GetPropertiesA( context, lower, tags);
  1681.     d0              a0      a1     a2
  1682.  
  1683.     ULONG GetPropertiesA( struct MMUContext *, void *, struct TagItem *);
  1684.  
  1685.  
  1686.     flags = GetProperties( context, lower, tag1, ...);
  1687.  
  1688.     ULONG GetProperties( struct MMUContext *, void *, Tag tag1, ...);
  1689.  
  1690.     FUNCTION
  1691.     This call reads the page properties of a certain address in
  1692.     memory from the software abstraction layer. It is the counterpart
  1693.     of SetProperties().
  1694.  
  1695.     INPUTS
  1696.     context - a handle to the context to investigate or NULL for the
  1697.         active context.
  1698.  
  1699.     lower   - the logical address of the page to investigate. The
  1700.         size of the page depends on the hardware and is selected by
  1701.         the MMU library. The number of bytes in a page is returned
  1702.         by GetPageSize().
  1703.  
  1704.     tags    - additional tags. Currently defined are:
  1705.  
  1706.         MAPTAG_DESTINATION  -   a pointer to a void * where 
  1707.             the physical destination of the logical address is
  1708.             filled in. Only available if the page is physically
  1709.             mapped to somewhere. Not filled in otherwise.
  1710.  
  1711.         MAPTAG_BLOCKID      -   read the a unique ID for the 
  1712.             MAPP_SWAPPED property. Untouched if the page isn't
  1713.             swapped. The tag data points to a long word which will
  1714.             be filled in for swapped out pages.
  1715.         
  1716.         MAPTAG_USERDATA     -   read the unique cookie for 
  1717.             INVALID pages, fill in the long word pointed to by
  1718.             the tag data field.
  1719.  
  1720.         MAPTAG_DESCRIPTOR   -   fill in the location of the
  1721.             indirect descriptor which is used to perform the
  1722.             mapping. Only used if MAPP_INDIRECT is used.
  1723.  
  1724.     RESULTS
  1725.     Returns a binary flags field for the attributes to define. See
  1726.     SetProperties() for details. Remember that MAPP_USED or 
  1727.     MAPP_MODIFIED reflect the bits on the abstraction layer, not the
  1728.     true hardware bits. You MUST call GetPageProperties() to read
  1729.     them, and hence *MUST* use MAPP_SINGLE pages.
  1730.  
  1731.     NOTES
  1732.     The page size can be read with GetPageSize(). Check the return  
  1733.     code of this call!
  1734.  
  1735.     The flags returned are valid for the given context, a different
  1736.     context may return a different flag setting and even a different
  1737.     physical locations.
  1738.  
  1739.     WARNING: The flags returned DO NOT reflect the hardware flags
  1740.     in the MMU table for the context. They DO reflect the settings
  1741.     installed with SetProperties() on the abstraction layer of the
  1742.     MMU tables.
  1743.  
  1744.     The hardware table might differ for the following reasons:
  1745.  
  1746.         - SetProperties() was called, but the changes haven't been
  1747.           made active with RebuildTree() yet.
  1748.         - A program modified the hardware layer directly using
  1749.           SetPageProperties().
  1750.         - DMA is currently active and the page in question has 
  1751.           therefore been marked as non-cacheable temporarely.
  1752.  
  1753.     Additionally, the library might have adjusted the abstraction
  1754.     layer itself by allocating non-cacheabe memory for its
  1755.     MMU tables.
  1756.  
  1757.     This routine is *NOT* safe to be called from within interrupts.
  1758.  
  1759.     BUGS
  1760.  
  1761.     SEE ALSO
  1762.     SetProperties(), AddContextHook(), GetMappingProperties(),
  1763.     GetPageSize(), GetPageProperties(), RebuildTree()
  1764.  
  1765. mmu.library/GetPageProperties         mmu.library/GetPageProperties
  1766.  
  1767.     
  1768.     NAME
  1769.     GetPropertiesA - read memory attributes from the hardware level
  1770.     for a given logical page. 
  1771.  
  1772.     SYNOPSIS
  1773.  
  1774.     flags = GetPagePropertiesA( context, lower, tags);
  1775.     d0                  a0       a1    a2
  1776.  
  1777.     ULONG GetPagePropertiesA( struct MMUContext *, void *, 
  1778.  
  1779.                 struct TagItem *);
  1780.  
  1781.  
  1782.     result = GetPageProperties( context, lower, tag1, ...);
  1783.  
  1784.     BOOL GetPageProperties( struct MMUContext *, void *, Tag tag1, ...);
  1785.  
  1786.     FUNCTION
  1787.     This call reads the page properties of a certain address in
  1788.     memory directly from the hardware. It is the counterpart
  1789.     of SetPageProperties().
  1790.  
  1791.     INPUTS
  1792.     context - a handle to the context to investigate or NULL for the
  1793.         active context. The library might use the MMU hardware directly
  1794.         if NULL is passed in, this call might be faster therefore.
  1795.  
  1796.     lower   - the logical address of the page to investigate. The
  1797.         size of the page depends on the hardware and is selected by
  1798.         the MMU library. The number of bytes in a page is returned
  1799.         by GetPageSize().
  1800.  
  1801.     tags    - additional tags. See GetProperties() for details.
  1802.  
  1803.  
  1804.     RESULTS
  1805.     Returns a binary flags field for the attributes to define. See
  1806.     SetProperties() for details.
  1807.  
  1808.     NOTES
  1809.     The page size can be read with GetPageSize(). 
  1810.  
  1811.     The flags returned are valid for the given context, a different
  1812.     context may return a different flag setting and even a different
  1813.     physical location.
  1814.  
  1815.     WARNING: The flags returned reflect the NOT the hardware flags
  1816.     in the MMU table for the context except for the MODIFIED and USED
  1817.     properties, even though the hardware level is *almost* consistent
  1818.     with these flags. 
  1819.  
  1820.     The hardware table might differ slightly in the following 
  1821.     situations:
  1822.  
  1823.         - DMA is currently active and the page in question has 
  1824.           therefore been marked as non-cacheable temporarely.
  1825.           Therefore, the cache settings returned are what will be
  1826.           re-installed here when DMA is finished. The library
  1827.           will "fake" the flags you have installed for the page
  1828.           investigated.
  1829.         - The library will use invalid descriptors to implement
  1830.           supervisor only or swapped pages.
  1831.  
  1832.     However, even though the flags might differ from the hardware
  1833.     flags, you're always safe to re-install the properties with
  1834.     SetPageProperties, there's no need to keep track of pecularities
  1835.     like cache disabling for DMA pages. The library does this for you.
  1836.  
  1837.     MAPP_MODIFIED and MAPP_USED are always read from the hardware
  1838.     directly.
  1839.  
  1840.     KEEP IN MIND that these two bits are only set and handled
  1841.     consistently for MAPP_SINGLE pages. You MUST NOT interpret
  1842.     them in all other cases, their values might get lost on a
  1843.     RebuildTree() call.
  1844.  
  1845.     This routine is safe to be called from within interrupts, most
  1846.     useful within exception handlers.
  1847.  
  1848.     BUGS
  1849.  
  1850.     SEE ALSO
  1851.         GetProperties(), AddContextHook(), 
  1852.         GetPageSize(), SetPageProperties(), RebuildTree()
  1853.  
  1854. mmu.library/AllocAligned                   mmu.library/AllocAligned
  1855.  
  1856.     NAME
  1857.     AllocAligned    -   allocate memory aligned to a memory border.
  1858.  
  1859.     SYNOPSIS
  1860.     mem = AllocAligned( bytesize, reqments, align );
  1861.     d0            d0     d1    a0
  1862.  
  1863.     void * AllocAligned( ULONG, ULONG, ULONG);
  1864.  
  1865.     FUNCTION
  1866.     Allocate memory aligned to certain boundaries.
  1867.  
  1868.     INPUTS
  1869.     bytesize - the size of the memory to allocate. 
  1870.  
  1871.     reqments -  exec style memory attributes
  1872.  
  1873.     align   -   the alignment restrictions of the page.
  1874.             MUST be a power of two.
  1875.  
  1876.     RETURNS
  1877.     a pointer to the allocated memory, aligned to the given border or
  1878.     NULL if no free physical memory could be found.
  1879.  
  1880.     NOTES
  1881.     Examples of how to use the "align" parameter:
  1882.  
  1883.     mem = AllocAligned(123,MEMF_PUBLIC|MEMF_CLEAR,1024);
  1884.  
  1885.     will allocate 123 bytes starting at a 1024 byte border, i.e. 
  1886.     the address returned will be divisible by 1024. The call will 
  1887.     clear the 123 bytes, NOT MORE.
  1888.  
  1889.     This is a service routine for the memory.library and shouldn't be
  1890.     used for all-day purposes.
  1891.  
  1892.     A DOS process will have its pr_Result2 field set to
  1893.     ERROR_NO_FREE_STORE if the memory allocation fails.
  1894.  
  1895.     The mmu.library calls this function by using its LVO library entry,
  1896.     so it can be patched to a smarter implementation if desired.
  1897.  
  1898.     BUGS
  1899.  
  1900.     SEE ALSO
  1901.     GetPageSize(), exec/memory.h
  1902.  
  1903. mmu.library/LockMMUContext             mmu.library/LockMMUContext
  1904.  
  1905.     NAME
  1906.     LockMMUContext      -   lock a MMU context
  1907.  
  1908.     SYNOPSIS
  1909.     LockMMUContext( context );
  1910.               a0
  1911.  
  1912.     void LockMMUContext( struct MMUContext * );
  1913.  
  1914.     FUNCTION
  1915.     Lock the software abstraction layer of the MMU table against
  1916.     modifications from other tasks.
  1917.  
  1918.     INPUTS
  1919.     A handle to a MMUContext or NULL for the active context.
  1920.  
  1921.     RETURNS
  1922.  
  1923.     NOTES
  1924.     This mechanism DOES NOT avoid changes of the MMU table on a lower
  1925.     level by SetPageProperties(), only SetProperties() from other
  1926.     tasks will be locked.
  1927.     Hence, it locks the abstraction layer, but not the hardware
  1928.     level.
  1929.  
  1930.     DO NOT lock more than one context at once, unless you locked
  1931.     also the context list with LockContextList(). Not following 
  1932.     this rule might cause deadlocks.
  1933.  
  1934.     BUGS
  1935.  
  1936.     SEE ALSO
  1937.     UnlockMMUContext(), SetPageProperties(), SetProperties(),
  1938.     LockContextList().
  1939.  
  1940. mmu.library/UnlockMMUContext           mmu.library/UnlockMMUContext
  1941.  
  1942.     NAME
  1943.     UnlockMMUContext    -   release a MMU context
  1944.  
  1945.     SYNOPSIS
  1946.     UnlockMMUContext( context );
  1947.                 a0
  1948.  
  1949.     void UnlockMMUContext( struct MMUContext * );
  1950.  
  1951.     FUNCTION
  1952.     Release the software abstraction layer of the MMU table, allow
  1953.     modifications from other tasks.
  1954.  
  1955.     INPUTS
  1956.     A handle to a MMUContext or NULL for the active context.
  1957.  
  1958.     RETURNS
  1959.  
  1960.     NOTES
  1961.     This mechanism DOES NOT avoid changes of the MMU table on a lower
  1962.     level by SetPageProperties(), only SetProperties() from other
  1963.     tasks will be locked.
  1964.     Hence, it locks the abstraction layer, but not the hardware
  1965.     level.
  1966.  
  1967.     BUGS
  1968.  
  1969.     SEE ALSO
  1970.     LockMMUContext(), SetPageProperties(), SetProperties(),
  1971.     AttemptLockMMUContext()
  1972.  
  1973. mmu.library/AttemptLockMMUContext      mmu.library/AttemptLockMMUContext
  1974.  
  1975.     NAME
  1976.     AttemptLockMMUContext       -   attempt to lock a MMU context
  1977.  
  1978.     SYNOPSIS
  1979.     ok = AttemptLockMMUContext( context );
  1980.                       a0
  1981.  
  1982.     struct MMUContext * AttemptLockMMUContext( struct MMUContext * );
  1983.  
  1984.     FUNCTION
  1985.     Grants non-blocking access to a MMU context.
  1986.     Attempts to lock the software abstraction layer of the MMU 
  1987.     table against modifications from other tasks. 
  1988.  
  1989.     INPUTS
  1990.     A handle to a MMUContext or NULL for the active context.
  1991.  
  1992.     RETURNS
  1993.     TRUE in case of success - the context is then locked for you
  1994.     and this lock must be released with UnlockMMUContext().
  1995.     FALSE in case any other task holds a lock.
  1996.  
  1997.     NOTES
  1998.     This mechanism DOES NOT avoid changes of the MMU table on a lower
  1999.     level by SetPageProperties(), only SetProperties() from other
  2000.     tasks will be locked.
  2001.     Hence, it locks the abstraction layer, but not the hardware
  2002.     level.
  2003.  
  2004.     DO NOT lock more than one context at once, unless you locked
  2005.     also the context list with LockContextList(). Not following 
  2006.     this rule might cause deadlocks.
  2007.  
  2008.     BUGS
  2009.     In pre-V39 machines, this call does not lock the context again
  2010.     in case you already hold a lock. This is a bug of the pre-V39
  2011.     AttemptSemaphore(), read the exec autodocs for a workaround.
  2012.  
  2013.     SEE ALSO
  2014.     UnlockMMUContext(), SetPageProperties(), SetProperties(),
  2015.     LockContextList(), AttemptSemaphore()
  2016.  
  2017. mmu.library/LockContextList            mmu.library/LockContextList
  2018.  
  2019.     NAME
  2020.     LockContextList     -   arbitrate a master lock.
  2021.  
  2022.     SYNOPSIS
  2023.     LockContextList( );
  2024.  
  2025.     void LockContextList( void );
  2026.  
  2027.     FUNCTION
  2028.     Arbitrates a master lock that allows locking more than one context
  2029.     at once to avoid deadlocks.
  2030.  
  2031.     INPUTS
  2032.  
  2033.     RETURNS
  2034.  
  2035.     NOTES
  2036.     This lock grants access for locking more than one context at once,
  2037.     to avoid deadlocks. I.e. in case you need to lock more than one
  2038.     context at a time, get this lock FIRST, then lock the contexts
  2039.     in any order you prefer.
  2040.  
  2041.     This call DOES NOT avoid modification of the context list or 
  2042.     individual contexts at all, i.e. other tasks are still able
  2043.     to create and to dispose contexts. To avoid this, you must lock
  2044.     the contexts afterwards.
  2045.  
  2046.     When you're done with the contexts, unlock the contexts first,
  2047.     THEN release this lock with UnlockContextList(). NOTE THE ORDER!
  2048.     
  2049.     BUGS
  2050.  
  2051.     SEE ALSO
  2052.     UnlockContextList(), LockMMUContext(), AttemptLockContextList()
  2053.  
  2054. mmu.library/UnlockContextList          mmu.library/UnlockContextList
  2055.  
  2056.     NAME
  2057.     UnlockContextList   -   release the master context lock
  2058.  
  2059.     SYNOPSIS
  2060.     UnlockContextList( );
  2061.  
  2062.     void UnlockContextList( void );
  2063.  
  2064.     FUNCTION
  2065.     Releases the master lock that allows locking more than one context
  2066.     at once to avoid deadlocks.
  2067.  
  2068.     INPUTS
  2069.  
  2070.     RETURNS
  2071.  
  2072.     NOTES
  2073.     This lock grants access for locking more than one context at once,
  2074.     to avoid deadlocks. I.e. in case you need to lock more than one
  2075.     context at a time, get this lock FIRST, then lock the contexts
  2076.     in any order you prefer.
  2077.  
  2078.     This call DOES NOT avoid modification of the context list or 
  2079.     individual contexts at all, i.e. other tasks are still able
  2080.     to create and to dispose contexts. To avoid this, you must lock
  2081.     the contexts afterwards.
  2082.  
  2083.     When you're done with the contexts, unlock the contexts first,
  2084.     THEN release this lock with UnlockContextList(). NOTE THE ORDER!
  2085.  
  2086.     BUGS
  2087.  
  2088.     SEE ALSO
  2089.     LockContextList(), LockMMUContext(), AttemptLockContextList()
  2090.  
  2091. mmu.library/AttemptLockContextList     mmu.library/AttemptLockContextList
  2092.  
  2093.     NAME
  2094.     AttemptLockContextList      -   attempt to arbitrate the master lock.
  2095.  
  2096.     SYNOPSIS
  2097.     ok = AttemptLockContextList( );
  2098.  
  2099.     LONG AttemptLockContextList( void );
  2100.  
  2101.     FUNCTION
  2102.     Attempts granting the context master lock in a non-blocking
  2103.     fashion. 
  2104.  
  2105.     INPUTS
  2106.  
  2107.     RETURNS
  2108.     TRUE in case the master lock could be arbitrated. You have then to
  2109.     release it with UnlockContextList().
  2110.     FALSE in case it is already locked and access could not be granted.
  2111.  
  2112.     NOTES
  2113.     This lock grants access for locking more than one context at once,
  2114.     to avoid deadlocks. I.e. in case you need to lock more than one
  2115.     context at a time, get this lock FIRST, then lock the contexts
  2116.     in any order you prefer.
  2117.  
  2118.     This call DOES NOT avoid modification of the context list or 
  2119.     individual contexts at all, i.e. other tasks are still able
  2120.     to create and to dispose contexts. To avoid this, you must lock
  2121.     the contexts afterwards.
  2122.  
  2123.     When you're done with the contexts, unlock the contexts first,
  2124.     THEN release this lock with UnlockContextList(). NOTE THE ORDER!
  2125.  
  2126.     BUGS
  2127.     In pre-V39 machines, this call does not lock the context again
  2128.     in case you already hold a lock. This is a bug of the pre-V39
  2129.     AttemptSemaphore(), read the exec autodocs for a workaround.
  2130.  
  2131.     SEE ALSO
  2132.     UnlockContextList(), LockMMUContext(), LockContextList(),
  2133.     AttemptLockSemaphore()
  2134.     
  2135. mmu.library/AllocLineVec               mmu.library/AllocLineVec
  2136.  
  2137.     NAME
  2138.     AllocLineVec    -   allocate cache line aligned, keep size
  2139.  
  2140.     SYNOPSIS
  2141.     AllocLineVec ( bytesize , attributes );
  2142.               d0          d1
  2143.  
  2144.     void * AllocLineVec ( ULONG, ULONG );
  2145.  
  2146.     FUNCTION
  2147.     Allocates memory like AllocVec(), but the memory is guaranteed
  2148.     to be aligned to cache lines of the processors in the system,
  2149.     even though the pointer returned IS NOT.
  2150.     Minimal guaranteed alignment is currently 32 bytes, i.e. a 
  2151.     PPC cache line. Future hardware may require stricter alignments.
  2152.  
  2153.     AllocLineVec'd memory is released with FreeVec() from the
  2154.     exec.library.
  2155.  
  2156.     INPUTS
  2157.     bytesize    -   the size of the memory block in bytes.
  2158.     attributes  -   memory attributes, see exec.library/AllocMem.
  2159.  
  2160.     RETURNS
  2161.     a pointer to the memory allocated or NULL on failure.
  2162.  
  2163.     A DOS process will have its pr_Result2 field set to
  2164.     ERROR_NO_FREE_STORE if the memory allocation fails.
  2165.  
  2166.     NOTES
  2167.     BIG WARNING: The pointer returned IS NEVER cache line aligned
  2168.     itself, but the complete memory block toghether with the
  2169.     vector size is kept in a cache line, regardless of the size
  2170.     passed in. Due to alignment restrictions, the routine might
  2171.     allocate a larger memory block than requested. It is however
  2172.     guaranteed that AT LEAST the size requested is returned, and
  2173.     that a FreeVec() will, indeed, free all memory.
  2174.  
  2175.     If MEMF_CLEAR is requested, the memory is cleared on the
  2176.     MC68K side, but the "zeros written" might be still in the
  2177.     cache. Hence, it is a good idea to flush the cache if the
  2178.     memory is passed over to the PPC.
  2179.  
  2180.     However, the vector size itself is always "pushed" to 
  2181.     memory, it is therefore guaranteed to be properly written
  2182.     back to the memory.
  2183.  
  2184.     The memory allocated this way is released by FreeVec() of
  2185.     the exec.library.
  2186.  
  2187.     BUGS
  2188.  
  2189.     SEE ALSO
  2190.     exec.library/AllocVec(), exec.library/FreeVec(), AllocLineVec()
  2191.  
  2192. mmu.library/PhysicalPageLocation       mmu.library/PhysicalPageLocation
  2193.  
  2194.     NAME
  2195.     PhysicalPageLocation    -   translate logical address to physical
  2196.  
  2197.     SYNOPSIS
  2198.     addr = PhysicalPageLocation( context , addr );
  2199.     d0                a0      a1
  2200.  
  2201.     void * PhysicalPageLocation( struct MMUContext * , void * );
  2202.  
  2203.     FUNCTION
  2204.     This function finds the physical address for the logical address
  2205.     passed in by scanning the MMU hardware table. 
  2206.     If the physical address is not available, NULL is returned.
  2207.  
  2208.     INPUTS
  2209.     context - the context to enter or NULL for the current context.
  2210.     addr    - the logical address to be translated.
  2211.  
  2212.     RETURNS
  2213.     the physical address of the logical address passed in, or NULL
  2214.     in case the logical address is not swapped in or otherwise out of
  2215.     control of the library.
  2216.  
  2217.     NOTES
  2218.     This is the low-level function, consider using the high-level
  2219.     function PhysicalLocation() when possible.
  2220.     This call can be safely used within interrupts.
  2221.  
  2222.     BUGS
  2223.     The function will also return NULL in case the logical address
  2224.     is translated to the address 0L. However, 0L should never be 
  2225.     used as physical address anyhow.
  2226.  
  2227.     SEE ALSO
  2228.     GetPageProperties(), PhysicalLocation()
  2229. mmu.library/PhysicalLocation           mmu.library/PhysicalLocation
  2230.  
  2231.     NAME
  2232.     PhysicalLocation    -   translate logical address to physical
  2233.  
  2234.     SYNOPSIS
  2235.     props = PhysicalLocation( context, addrptr, lenptr );
  2236.     d0                d1       a0       a1
  2237.  
  2238.     ULONG PhysicalLocation( struct MMUContext * , void ** , ULONG * );
  2239.  
  2240.     FUNCTION
  2241.     This function finds the physical address for the logical address
  2242.     passed in by scanning the software abstraction layer.
  2243.     If the physical address is not available, NULL is returned.
  2244.  
  2245.     INPUTS
  2246.     context - the context to enter or NULL for the current context.
  2247.     addrptr - points to the logical address to be translated.
  2248.           The physical address is filled in here, or NULL in case
  2249.           the logical address passed in is not available.
  2250.     lenptr  - Points to the length of the address range to be trans-
  2251.           lated. The function returns the length of the largest 
  2252.           possible continous memory range contained in the memory
  2253.           range passed in. Hence, this function may shorten the
  2254.           memory block for fragmentized memory models. It will
  2255.           NULL in case the memory is not available.
  2256.  
  2257.     RETURNS
  2258.     the properties of the memory range.
  2259.  
  2260.     NOTES
  2261.     This is the high-level function, it is not callable from within
  2262.     interrupts.
  2263.  
  2264.     In case you've to operate on a range of physical memory, start
  2265.     the translation with this call, then compare the size returned
  2266.     with the size of the memory block passed in. Because this 
  2267.     function may shorten the memory size in case the physical 
  2268.     memory is fragmentated, you should be prepared that the size
  2269.     returned is smaller than what was passed in. In this case, operate
  2270.     on the memory region returned, then add the returned size to
  2271.     the original logical address and call this function again to
  2272.     get the physical location of the next chunk.
  2273.  
  2274.     BUGS
  2275.     The function will also return NULL in case the logical address
  2276.     is translated to the address 0L. However, 0L should never be 
  2277.     used as physical address anyhow.
  2278.  
  2279.     SEE ALSO
  2280.     GetProperties(), PhysicalPageLocation()
  2281. mmu.library/DMAInitiate                mmu.library/DMAInitiate
  2282.  
  2283.     NAME
  2284.     DMAInitiate     -   start a DMA transport given a logical address.
  2285.  
  2286.     SYNOPSIS
  2287.     fine = DMAInitiate( context, addrptr, lenptr, write );
  2288.                  d1       a0     a1     d0
  2289.  
  2290.     BOOL DMAInitiate( struct MMUContext * , void ** , ULONG * , BOOL );
  2291.  
  2292.     FUNCTION
  2293.     This function finds the physical address for the logical address
  2294.     passed in by scanning a backup of the MMU translation tree.
  2295.     It ignores modifications made by the high-level and low-level
  2296.     functions unless RebuildTree() is called.
  2297.  
  2298.     INPUTS
  2299.     context - the context to enter or NULL for the current context.
  2300.           NOTE: This parameter is currently a dummy and should be
  2301.           set to NULL. The mmu.library will always use the public
  2302.           context for translation.
  2303.     addrptr - points to the logical address to be translated.
  2304.           The physical address is filled in here.
  2305.     lenptr  - Points to the length of the address range to be trans-
  2306.           lated. The function returns the length of the largest 
  2307.           possible continous memory range contained in the memory
  2308.           range passed in. Hence, this function may shorten the
  2309.           memory block for fragmentized memory models.
  2310.     write   - set this to TRUE for transports from a DMA device INTO
  2311.           the memory, i.e. device reads. Set this to FALSE for
  2312.           writes from memory to the device.
  2313.  
  2314.     RETURNS
  2315.     fine    - TRUE if the address and length passed in pointed to available
  2316.           memory. FALSE if the requested DMA transfer was invalid.
  2317.  
  2318.     The result code is new for V42, do not check it for V41 or below.
  2319.  
  2320.     NOTES
  2321.     The function checks whether the memory range passed in is available
  2322.     for DMA. It will guru in case it is not, i.e. the page is either
  2323.     swapped out, invalid, indirect, or write protected for
  2324.     DMA device reads. Reads into ROM addresses are silently tolerated,
  2325.     and, hence, are translations to and from blank dummy pages.
  2326.  
  2327.     This function is callable from within interrupts, but does only
  2328.     use a backup of the high-level table for its translation.
  2329.     Changes to the software abstraction level are not visible for
  2330.     this function unless RebuildTree() is called. Changes to the
  2331.     hardware level are not at all visible to this (and all other
  2332.     high-level) functions.
  2333.  
  2334.     In case you've to operate on a range of physical memory, start
  2335.     the translation with this call, then compare the size returned
  2336.     with the size of the memory block passed in. Because this 
  2337.     function may shorten the memory size in case the physical 
  2338.     memory is fragmentated, you should be prepared that the size
  2339.     returned is smaller than what was passed in. With the physical
  2340.     address returned, start the DMA and call DMATerminate() when
  2341.     done.
  2342.     In case the returned size is smaller than the block passed in,
  2343.     add the returned size to the original logical address and 
  2344.     call this function again to get the physical location of the 
  2345.     next chunk.
  2346.  
  2347.     EACH CALL TO DMAInitiate() must be matched by ONE AND PRECISELY
  2348.     ONE call to DMATerminate().
  2349.  
  2350.     Even though this function does not require locking the context, 
  2351.     I highly recommend doing so. It won't crash if you don't, but
  2352.     someone else could modify the MMU translation table in between.
  2353.     The library can deal with that, but the result of the DMA 
  2354.     operation might be different than what you expect.
  2355.  
  2356.     The pre-V42 releases did not return a result code but generated
  2357.     an alert in case illegal memory has been passed in. This changed
  2358.     for V42. DO NOT assume a meaningful result code for V41 or
  2359.     below.
  2360.  
  2361.     BUGS
  2362.     This function should really use the context passed in, but
  2363.     since most (if not all) DMA device drivers do not keep the 
  2364.     context of the task that actually initiated the transfer and
  2365.     hence would use the wrong context anyhow, DMA is currently limited
  2366.     to the public context.
  2367.  
  2368.     SEE ALSO
  2369.     DMATerminate(), PhysicalPageLocation(), exec/CachePreDMA()
  2370. mmu.library/DMATerminate               mmu.library/DMATerminate
  2371.  
  2372.     NAME
  2373.     DMATerminate    -   end a DMA transfer initiated by DMAInitiate.
  2374.  
  2375.     SYNOPSIS
  2376.     DMATerminate( context );
  2377.             d1       
  2378.  
  2379.     void DMATerminate( struct MMUContext * );
  2380.  
  2381.     FUNCTION
  2382.     This function ends a DMA transfer initiated by DMAInitate. It
  2383.     releases the resources by the first call.
  2384.  
  2385.     INPUTS
  2386.     context - the context to enter or NULL for the current context.
  2387.           NOTE: This parameter is currently a dummy and should be
  2388.           set to NULL. The mmu.library will always use the public
  2389.           context for translation.
  2390.  
  2391.     RETURNS
  2392.  
  2393.     NOTES
  2394.     This function is callable from within interrupts, but does only
  2395.     use a backup of the high-level table for its translation.
  2396.     Changes to the software abstraction level are not visible for
  2397.     this function unless RebuildTree() is called. Changes to the
  2398.     hardware level are not at all visible to this (and all other
  2399.     high-level) functions.
  2400.  
  2401.     EACH CALL TO DMAInitiate() must be matched by ONE AND PRECISELY
  2402.     ONE call to DMATerminate().
  2403.  
  2404.     For details, check the DMAInitiate() function.
  2405.  
  2406.     BUGS
  2407.     This function should really use the context passed in, but
  2408.     since most (if not all) DMA device drivers do not keep the 
  2409.     context of the task that actually initiated the transfer and
  2410.     hence would use the wrong context anyhow, DMA is currently limited
  2411.     to the public context.
  2412.  
  2413.     SEE ALSO
  2414.     DMAInitiate(), PhysicalPageLocation(), exec/CachePostDMA()
  2415. mmu.library/GetMapping                 mmu.library/GetMapping
  2416.  
  2417.     NAME
  2418.     GetMapping  -   get access to the memory map of a MMUContext
  2419.  
  2420.     SYNOPSIS
  2421.     list = GetMapping( context );
  2422.     d0             a0
  2423.  
  2424.     struct MinList * GetMapping( struct MMUContext * );
  2425.  
  2426.     FUNCTION
  2427.     This function makes a copy of the MapNodes for the given context.
  2428.     The nodes in this list describe the memory map as seen from tasks
  2429.     attached to this context, sorted by logical addresses.
  2430.     The list must be released afterwards with ReleaseMapping().
  2431.  
  2432.     INPUTS
  2433.     context - the context to enter or NULL for the current context.
  2434.  
  2435.     RETURNS
  2436.     a pointer to a struct MinList which contains the MapNodes for this
  2437.     context, sorted by physical address, or NULL in case of failure.
  2438.  
  2439.     NOTES
  2440.     The nodes are just a copy of the real nodes within the context.
  2441.     
  2442.     This function is most useful to make a backup of the context
  2443.     memory map before altering it. In case any of the modifications
  2444.     fail, you are able to undo all modifications completely with
  2445.     a call to SetPropertyList() - which can't fail. 
  2446.  
  2447.     To give an example:
  2448.  
  2449.     /* make a backup of the context how it looks now */
  2450.  
  2451.     LockMMUContext(ctx);
  2452.  
  2453.     if (list=GetMapping(ctx)) {
  2454.         fine=TRUE;
  2455.  
  2456.         /* Try to alter it, step by step. */
  2457.  
  2458.         if (!SetProperties(...)) 
  2459.         fine=FALSE;
  2460.  
  2461.         if (!SetProperties(...))
  2462.         fine=FALSE;
  2463.  
  2464.         /* etc, etc.... */
  2465.  
  2466.         /* Oops, we failed! Re-install the old setup. */
  2467.         if (!fine) 
  2468.         SetPropertyList(ctx,list);
  2469.     }
  2470.     
  2471.     ReleaseMapping(ctx,list);
  2472.     UnlockMMUContext(ctx);
  2473.     /* and so on... */
  2474.  
  2475.     Note that you've still to call ReleaseContextList(), even in
  2476.     case of failure when you've already re-installed backup property
  2477.     list.
  2478.  
  2479.     BUGS
  2480.  
  2481.     SEE ALSO
  2482.     ReleaseMapping(), SetPropertyList(), mmu/context.h
  2483. mmu.library/ReleaseMapping             mmu.library/ReleaseMapping
  2484.  
  2485.     NAME
  2486.     ReleaseMapping  -   get access to the memory map
  2487.  
  2488.     SYNOPSIS
  2489.     ReleaseMapping( context , list );
  2490.              a0    a1
  2491.  
  2492.     void ReleaseMapping( struct MMUContext * , struct MinList * );
  2493.  
  2494.     FUNCTION
  2495.     This function releases the list of MapNodes arbitrated by 
  2496.     GetMapping.
  2497.  
  2498.     INPUTS
  2499.     context - the context the nodes where taken from.
  2500.     list    - the backup property list to release.
  2501.  
  2502.     RETURNS
  2503.  
  2504.     NOTES
  2505.     This function *MUST* be called, even in case the property list
  2506.     was re-installed with SetPropertyList().
  2507.  
  2508.     BUGS
  2509.  
  2510.     SEE ALSO
  2511.     NewMapping(), GetMapping(), SetPropertyList()
  2512.  
  2513. mmu.library/NewMapping                 mmu.library/NewMapping
  2514.  
  2515.     NAME
  2516.     NewMapping      -   build a new memory map
  2517.  
  2518.     SYNOPSIS
  2519.     list = NewMapping ( );
  2520.     d0
  2521.  
  2522.     struct MinList * NewMapping ( void );
  2523.  
  2524.     FUNCTION
  2525.     Build and initialize a new memory map list. All addresses in this
  2526.     list will be marked as MAPP_BLANK.
  2527.  
  2528.     INPUTS
  2529.     nothing.
  2530.  
  2531.     RESULTS
  2532.     a MinList structure, initialized with MapNodes representing a
  2533.     completely blank memory layout or NULL on failure. You either need 
  2534.     to copy the layout from a context with CopyContextRegion(), or 
  2535.     define your own layout with calls to SetMappingProperties().
  2536.  
  2537.     NOTES
  2538.     Don't forget to release the list (and its contents) with 
  2539.     ReleaseMapping() when you're done.
  2540.  
  2541.     BUGS
  2542.  
  2543.     SEE ALSO
  2544.     CopyContextRegion(), SetMappingProperties(), ReleaseMapping(),
  2545.     GetMapping()
  2546.  
  2547. mmu.library/CopyMapping                mmu.library/CopyMapping
  2548.  
  2549.     NAME
  2550.     CopyMapping     -   transfer memory properties between lists
  2551.  
  2552.     SYNOPSIS
  2553.     fine = CopyMapping ( from , to , base , length , mask );
  2554.     d0              a0    a1    d0      d1      d2     
  2555.  
  2556.  
  2557.     BOOL CopyMapping ( struct MinList * , struct MinList * ,
  2558.  
  2559.                  ULONG , ULONG , ULONG );
  2560.  
  2561.     FUNCTION
  2562.     Copy the memory properties from one memory map to another, thru
  2563.     a mask.
  2564.  
  2565.     INPUTS
  2566.     from    -   the memory map which is (partially) to be transfered.
  2567.     to      -   the destination of the copy operation.
  2568.     base    -   base address. Memory properties will be copied starting
  2569.             at this address.
  2570.     length  -   length of the memory region in bytes whose properties
  2571.             shall be transfered.
  2572.     mask    -   a mask of property bits which are to be transfered. A
  2573.             zero bit in this mask indicates that the corresponding
  2574.             property in the destination will not be touched. For
  2575.             all the properties, check the SetProperties() function.
  2576.  
  2577.     RESULTS
  2578.     a boolean success/failure indicator. It is TRUE in case the 
  2579.     operation was performed, FALSE otherwise. The destination will
  2580.     not have been touched at all in this case.
  2581.  
  2582.     NOTES
  2583.     this call does not copy memory. It just copies memory attributes
  2584.     from one memory map to another.
  2585.  
  2586.     Check CopyContextRegion() to copy the properties from a context
  2587.     instead from a list.
  2588.  
  2589.     Since this call is not context based, the library will not be able
  2590.     to perform checks for correct page alignment, you have to do that
  2591.     yourself. Especially, note that SetPropertyList() - which attaches
  2592.     a memory map to a context - does not perform any check on this
  2593.     list either. Hence, *NOT* checking for page alignment here might
  2594.     result in an invalid context if you try to attach an incorrectly
  2595.     aligned list to a context later on. 
  2596.  
  2597.     BUGS
  2598.  
  2599.     SEE ALSO
  2600.     SetPropertyList(), ReleaseMapping(), DupMapping(), SetProperties(),
  2601.     CopyContextRegion()
  2602.  
  2603. mmu.library/DupMapping                 mmu.library/DupMapping
  2604.  
  2605.     NAME
  2606.     DupMapping      -   make a one-to-one copy of a memory map
  2607.  
  2608.     SYNOPSIS
  2609.     dup = DupMapping ( list );
  2610.     d0            a0
  2611.  
  2612.     struct MinList * DupMapping( struct MinList * );
  2613.  
  2614.     FUNCTION
  2615.     this call builds an identical copy of the memory map passed in.
  2616.  
  2617.     INPUTS
  2618.     list    -   the memory map to be copied.
  2619.  
  2620.     RESULTS
  2621.     another memory list, identical to the list passed in, or NULL on
  2622.     failure.
  2623.  
  2624.     NOTES
  2625.     Don't forget to release the memory list with ReleaseMapping()
  2626.     if you're done with it. You need to release both, the original as
  2627.     well as the duplicate.
  2628.     In case you want to make a copy of the memory map of a context,
  2629.     use GetMapping() instead.
  2630.  
  2631.     BUGS
  2632.  
  2633.     SEE ALSO
  2634.     GetMapping(), ReleaseMapping()
  2635.  
  2636. mmu.library/CopyContextRegion          mmu.library/CopyContextRegion
  2637.  
  2638.     NAME
  2639.     CopyContextRegion   -   transfer properties from a context to a list
  2640.  
  2641.     SYNOPSIS
  2642.     fine = CopyContextRegion ( ctx, list, base, length, mask );
  2643.     d0                a0   a1    d0    d1      d2
  2644.  
  2645.     BOOL CopyContextRegion ( struct MMUContext *, struct MinList *,
  2646.                  
  2647.                  ULONG, ULONG, ULONG );
  2648.  
  2649.     FUNCTION
  2650.     Copy the properties of a memory region defined by a context to 
  2651.     another memory map, thru a mask.
  2652.  
  2653.     INPUTS
  2654.     ctx     -   source context whose memory map shall be transfered.
  2655.     list    -   the destination memory map which is to be altered.
  2656.     base    -   base address of the memory region whose properties are
  2657.             to be copied.
  2658.     length  -   length of the memory region in bytes whose properties
  2659.             will be transfered.
  2660.     mask    -   a mask of property bits, see the SetProperties() 
  2661.             function for a detailed explanation. A zero bit in this
  2662.             mask means that the corresponding property in the 
  2663.             destination will be left alone and will remain unchanged.
  2664.  
  2665.     RESULTS
  2666.     a boolean success/failure indicator, TRUE for success. On failure,
  2667.     the destination memory map will not have been touched at all.
  2668.  
  2669.     NOTES
  2670.     This call does not copy memory at all, it just defines the memory
  2671.     properties of a given memory map from that of a given context.
  2672.  
  2673.     Check CopyMapping() to transport memory properties from one list
  2674.     to another.
  2675.  
  2676.     Since this call is not context based, the library will not be able
  2677.     to perform checks for correct page alignment, you have to do that
  2678.     yourself. Especially, note that SetPropertyList() - which attaches
  2679.     a memory map to a context - does not perform any check on this
  2680.     list either. Hence, *NOT* checking for page alignment here might
  2681.     result in an invalid context if you try to attach an incorrectly
  2682.     aligned list to a context later on. 
  2683.  
  2684.     BUGS
  2685.  
  2686.     SEE ALSO
  2687.     SetPropertyList(), ReleaseMapping(), SetProperties(),
  2688.     SetPropertiesMapping()
  2689.  
  2690. mmu.library/SetPropertiesMapping           mmu.library/SetPropertiesMapping
  2691.  
  2692.     NAME
  2693.     SetPropertiesMapping    -   transfer properties from a map list 
  2694.                     to a context
  2695.  
  2696.     SYNOPSIS
  2697.     fine = SetPropertiesMapping ( ctx, list, base, length, mask );
  2698.     d0                a0   a1    d0     d1      d2
  2699.  
  2700.     BOOL SetPropertiesMapping ( struct MMUContext *, struct MinList *,
  2701.                  
  2702.                  ULONG, ULONG, ULONG );
  2703.  
  2704.     FUNCTION
  2705.     Copy the properties of a memory map to a context, thru a mask.
  2706.     This is equivalent to SetProperties(), except that the source
  2707.     data is contained in a memory map instead given as function
  2708.     arguments. This function is reverse to CopyContextRegion().
  2709.  
  2710.     INPUTS
  2711.     ctx     -   destination context whose memory map shall be set.
  2712.     list    -   the source memory map, containing the data to be 
  2713.             transfered.
  2714.     base    -   base address of the memory region whose properties are
  2715.             to be copied.
  2716.     length  -   length of the memory region in bytes whose properties
  2717.             will be transfered.
  2718.     mask    -   a mask of property bits, see the SetProperties() 
  2719.             function for a detailed explanation. A zero bit in this
  2720.             mask means that the corresponding property in the 
  2721.             destination will be left alone and will remain unchanged.
  2722.  
  2723.     RESULTS
  2724.     a boolean success/failure indicator, TRUE for success. On failure,
  2725.     the destination context will not have been touched at all.
  2726.  
  2727.     NOTES
  2728.     This call does not copy memory at all, it just defines the memory
  2729.     properties of the context passed in.
  2730.  
  2731.     Check CopyMapping() to transport memory properties from one list
  2732.     to another, or CopyContextRegion() to transfer properties from a
  2733.     context to a list (the other direction).
  2734.  
  2735.     The library will not be able to perform checks for correct page 
  2736.     alignment, you have to do that yourself. 
  2737.     BUGS
  2738.  
  2739.     SEE ALSO
  2740.     SetPropertyList(), ReleaseMapping(), SetProperties(),
  2741.     CopyContextRegion()
  2742.  
  2743. mmu.library/SetMappingProperties      mmu.library/SetMappingProperties
  2744.  
  2745.     NAME
  2746.     SetMappingPropertiesA   -   set memory attributes in a memory map.
  2747.  
  2748.     SYNOPSIS
  2749.  
  2750.     result = SetMappingPropertiesA( list, flags, mask, lower, size, tags);
  2751.     d0                 a0     d1    d2    a1     d0    a2
  2752.  
  2753.     int SetMappingPropertiesA( struct MinList *, ULONG, ULONG, 
  2754.                    ULONG, ULONG, struct TagItem *);
  2755.  
  2756.  
  2757.     result = SetMappingProperties( list, flags, mask, 
  2758.                        lower, size, tag1, ...);
  2759.  
  2760.     int SetMappingProperties( struct MinList *, ULONG, ULONG, 
  2761.                   ULONG, ULONG, Tag tag1, ...);
  2762.  
  2763.     FUNCTION
  2764.     This call sets attributes of a certain memory range of a given
  2765.     memory map.
  2766.  
  2767.     INPUTS
  2768.     list    - a minlist structure keeping the memory map to be altered.
  2769.     flags   - a binary flags field for the attributes to define. Check
  2770.           SetProperties() for details about the defined bits.
  2771.     mask    - A bit mask of the attributes to be changed.
  2772.     lower   - The lower boundary of the logical address to be modified. 
  2773.     size    - Size of the region to be modified. 
  2774.     tags    - A tag array with additional data, identical to the
  2775.           tags defined for SetProperties().
  2776.  
  2777.     RESULTS
  2778.     Unlike SetProperties() or SetPageProperties(), this does not
  2779.     return a boolean value! The result code is 0 on failure, and
  2780.     different from zero on success, though. To be more precise, this
  2781.     routine will return "1" in case of success, and "2" in case the
  2782.     memory map was really altered and is now "dirty", hence upper
  2783.     software layers might require a "rebuild".
  2784.  
  2785.     NOTES
  2786.     This call really doesn't do anything to the MMU, it is just an
  2787.     administration call to modify a memory map - a handy data structure
  2788.     you might want to use for your own memory administration. Its
  2789.     context-based equivalent SetProperties() will, hence, adjust the
  2790.     memory map which is kept by a context, and SetPageProperties()
  2791.     will perform the same operation truely on the hardware.
  2792.  
  2793.     Since this call is not context based, the library will not be able
  2794.     to perform checks for correct page alignment, you have to do that
  2795.     yourself. Especially, note that SetPropertyList() - which attaches
  2796.     a memory map to a context - does not perform any check on this
  2797.     list either. Hence, *NOT* checking for page alignment here might
  2798.     result in an invalid context if you try to attach an incorrectly
  2799.     aligned list to a context later on. 
  2800.  
  2801.     BUGS
  2802.  
  2803.     SEE ALSO
  2804.     SetPropertyList(), ReleaseMapping(), SetProperties(),
  2805.     SetPageProperties(), GetMappingProperties()
  2806.  
  2807. mmu.library/GetMappingProperties      mmu.library/GetMappingProperties
  2808.  
  2809.     NAME
  2810.     GetMappingPropertiesA   - read memory attributes from a memory map.
  2811.  
  2812.     SYNOPSIS
  2813.  
  2814.     flags = GetMappingPropertiesA( list, lower, tags);
  2815.     d0                a0    a1     a2
  2816.  
  2817.     ULONG GetMappingPropertiesA( struct MinList *, ULONG, 
  2818.                      struct TagItem *);
  2819.  
  2820.     result = GetMappingProperties( list, lower, tag1, ...);
  2821.  
  2822.     ULONG GetMappingProperties( struct MinList *, ULONG, Tag tag1, ...);
  2823.  
  2824.     FUNCTION
  2825.     This call reads the page properties of a certain address in
  2826.     memory from a memory map. It is the counterpart of 
  2827.     SetMappingProperties() and the memory map analogue of 
  2828.     GetProperties().
  2829.  
  2830.     INPUTS
  2831.     list    -   a MinList holding the memory map, obtained from either
  2832.             GetMapping(), DupMapping() or NewMapping().
  2833.     lower   -   the logical address of the address to investigate. 
  2834.     tags    -   additional tags, identical to those defined for
  2835.             GetProperties(). Check the documentation of this
  2836.             function for details.
  2837.  
  2838.     RESULTS
  2839.     Returns a binary flags field for the attributes to define. See
  2840.     SetProperties() for details. 
  2841.  
  2842.     NOTES
  2843.     This call is the analogue of the GetProperties() call. It operates
  2844.     directly on memory maps, unlike the former which operates only on
  2845.     the memory map of a context. This function does not require page 
  2846.     alignment because the mmu.library does not have a context to check
  2847.     the alignment restrictions, but you should note that a memory map
  2848.     that is to be attached to a context with DefineMapping() *HAS* to
  2849.     be correctly aligned.
  2850.  
  2851.     This routine is *NOT* safe to be called from within interrupts.
  2852.  
  2853.     BUGS
  2854.  
  2855.     SEE ALSO
  2856.     SetMappingProperties(), SetProperties(), GetPageProperties(),
  2857.     GetProperties()
  2858.  
  2859. mmu.library/SetPropertyList            mmu.library/SetPropertyList
  2860.  
  2861.     NAME
  2862.     SetPropertyList     -   re-install a backup memory map
  2863.  
  2864.     SYNOPSIS
  2865.     SetPropertyList ( context, list );
  2866.                 a0      a1
  2867.  
  2868.     void SetPropertyList ( struct MMUContext * , struct MinList * );
  2869.  
  2870.     FUNCTION
  2871.     This call re-installes a property list, i.e. a complete memory
  2872.     map of a context, obtained from GetMapping() before.
  2873.     
  2874.     INPUTS
  2875.     context     -   the context the list should be installed in.
  2876.             This should be the same context the list was
  2877.             taken from.
  2878.     list    -   the property list to install. 
  2879.  
  2880.     This list *MUST* have been obtained with GetMapping() before.
  2881.  
  2882.     RESULTS
  2883.     Nothing. The big advantage of this call is that it cannot fail.
  2884.  
  2885.     NOTES
  2886.     The property list will become part of the context and is empty
  2887.     after this call. You can't re-use it for that reason. However,
  2888.     you still need to call ReleaseMapping() with the list pointer
  2889.     you've obtained before.
  2890.  
  2891.     For additional tips how this function should be used, see the
  2892.     GetMapping() function; especially, you can only un-do changes
  2893.     to the software abstraction level of a MMU-tree, and only as
  2894.     long as you haven't called RebuildTree() to translate these
  2895.     into hardware MMU tables. Trying to un-do these changes with
  2896.     SetPropertyList() will fail, and it will even fail if you call
  2897.     RebuildTree() afterwards. SetPropertyList() *does not* inform
  2898.     the software abstraction level about any changes, it is just a
  2899.     quick un-do operation. (For the experts: It even re-installs
  2900.     the "dirty" flags).
  2901.  
  2902.     BUGS
  2903.     
  2904.     SEE ALSO
  2905.     GetMapping(), ReleaseMapping(), RebuildTree()
  2906.  
  2907. mmu.library/GetMMUType                 mmu.library/GetMMUType
  2908.  
  2909.     NAME
  2910.     GetMMUType - return the type of the MMU available in the system.
  2911.  
  2912.     SYNOPSIS
  2913.     mmu = GetMMUType( );
  2914.             
  2915.  
  2916.     char GetMMUType( void );
  2917.  
  2918.     FUNCTION
  2919.     Returns an identifier for the MMU available in the system or
  2920.     NUL in case no MMU is installed.
  2921.  
  2922.     INPUTS
  2923.  
  2924.     RETURNS
  2925.     a character identifying the MMU type:
  2926.  
  2927.     MUTYPE_NONE        no working MMU detected.
  2928.     MUTYPE_68851        a 68020 system with an external 68851
  2929.                 MMU.
  2930.     MUTYPE_68030        a 68030 MMU.
  2931.     MUTYPE_68040        the internal 68040 MMU.
  2932.     MUTYPE_68060        the 68060 MMU.
  2933.  
  2934.     NOTES
  2935.     The mmu library is smart enough to detect EC processors without a
  2936.     working MMU, but the library does not detect multiple CPUs in the
  2937.     system. (How?)
  2938.  
  2939.     BUGS
  2940.  
  2941.     SEE ALSO
  2942.     mmu/mmubase.h
  2943. mmu.library/SuperContext               mmu.library/SuperContext
  2944.  
  2945.     NAME
  2946.     SuperContext - find the supervisor context for a given context.
  2947.  
  2948.     SYNOPSIS
  2949.     super = SuperContext( context );
  2950.     d0            a0              
  2951.  
  2952.     struct MMUContext * SuperContext( struct MMUContext * );
  2953.  
  2954.     FUNCTION
  2955.     Returns the context that manages the supervisor mode for the user
  2956.     mode context passed in.
  2957.  
  2958.     INPUTS
  2959.     A user mode context or NULL for the current context.
  2960.  
  2961.     RETURNS
  2962.     A pointer to the context managing the supervisor type accesses with-
  2963.     in the current context.
  2964.  
  2965.     NOTES
  2966.     All contexts build by CreateMMUContext are by default user mode
  2967.     contexts. The current version of the library manages one global
  2968.     supervisor tree, and optionally private supervisor trees for private
  2969.     contexts if you ask for one on context creation. This is different 
  2970.     to former releases!
  2971.     
  2972.     To find the public supervisor mode context, call DefaultContext() 
  2973.     first and pass in its return value to this function.
  2974.  
  2975.     BUGS
  2976.  
  2977.     SEE ALSO
  2978.     DefaultContext(), CreateMMUContext()
  2979.  
  2980. mmu.library/DefaultContext             mmu.library/DefaultContext
  2981.  
  2982.     NAME
  2983.     DefaultContext  -   get the global default context
  2984.  
  2985.     SYNOPSIS
  2986.     public = DefaultContext( );
  2987.     d0
  2988.  
  2989.     struct MMUContext * DefaultContext( void );
  2990.  
  2991.     FUNCTION
  2992.     Returns the global default user mode context which is used for
  2993.     tasks that are not attached to any other private context.
  2994.  
  2995.     INPUTS
  2996.  
  2997.     RETURNS
  2998.     A pointer to the context managing the user mode accesses for
  2999.     "context less" tasks.
  3000.  
  3001.     NOTES
  3002.     A task is by default part of this default context unless you
  3003.     call EnterMMUContext() and attach it to a different context.
  3004.  
  3005.     Note that you might have to enter even the default context
  3006.     explicitly to be able to use certain features of the exception
  3007.     hook mechanism.
  3008.  
  3009.     BUGS
  3010.  
  3011.     SEE ALSO
  3012.     SuperContext()
  3013. mmu.library/WithoutMMU                 mmu.library/WithoutMMU
  3014.  
  3015.     NAME
  3016.     WithoutMMU - execute a short subroutine with the MMU disabled.
  3017.  
  3018.     SYNOPSIS
  3019.     result = WithoutMMU( userFunc );
  3020.     d0            a5
  3021.  
  3022.     ULONG WithoutMMU(void *);
  3023.  
  3024.     FUNCTION
  3025.     Executes a small assembly language routine pointed to in a5
  3026.     in supervisor mode, with all interrupts disabled, and the MMU
  3027.     disabled. All registers are preserved by this call.
  3028.     The function must end with an RTS instruction.
  3029.  
  3030.     INPUTS
  3031.     userFunc    -   A pointer to a *short* assembly language routine,
  3032.             ending with RTS. The function has full access to
  3033.             all registers.
  3034.  
  3035.     RETURNS
  3036.     whatever was left in register d0 by the called function.
  3037.  
  3038.     NOTES
  3039.     This is a low-level function. Remember that disabling the MMU
  3040.     might or might not be what you want, especially if memory is
  3041.     remapped.
  3042.  
  3043.     Note that this function works even without a MMU. It just calls the
  3044.     routine in a5 in this case.
  3045.  
  3046.     BUGS
  3047.     Big trouble if the supervisor stack is in remapped memory.
  3048.  
  3049.     SEE ALSO
  3050.     exec/Supervisor(), RunOldConfig()
  3051. mmu.library/RunOldConfig                       mmu.library/RunOldConfig
  3052.  
  3053.     NAME
  3054.     RunOldConfig - execute a short subroutine with the old MMU configuration.   (V42)
  3055.  
  3056.     SYNOPSIS
  3057.     result = RunOldConfig( userFunc );
  3058.     d0              a5
  3059.  
  3060.     ULONG RunOldConfig(void *);
  3061.  
  3062.     FUNCTION
  3063.     Executes a small assembly language routine pointed to in a5
  3064.     in supervisor mode, with all interrupts disabled, and the MMU
  3065.     configuration the library found when it was started. This could 
  3066.     or could not be a disabled MMU.
  3067.     The function must end with an RTS instruction.
  3068.  
  3069.     INPUTS
  3070.     userFunc    -   A pointer to a *short* assembly language routine,
  3071.             ending with RTS. The function has full access to
  3072.             all registers.
  3073.  
  3074.     RETURNS
  3075.     whatever was left in register d0 by the called function.
  3076.  
  3077.     NOTES
  3078.     This is a low-level function. Remember that reloading the MMU
  3079.     with the last MMU configuration might or might not be what 
  3080.     you want, especially if memory is remapped or the MMU tables of
  3081.     the old configuration has been released.
  3082.  
  3083.     Note that this function works even without a MMU. It just calls the
  3084.     routine in a5 in this case.
  3085.  
  3086.     BUGS
  3087.     Big trouble if the supervisor stack is in remapped memory.
  3088.  
  3089.     SEE ALSO
  3090.     exec/Supervisor(), WithoutMMU()
  3091. mmu.library/SetBusError                mmu.library/SetBusError
  3092.  
  3093.     NAME
  3094.     SetBusError - define the bus error handler.
  3095.  
  3096.     SYNOPSIS
  3097.     SetBusError ( newfuncptr , oldfuncptrptr );
  3098.     d0        a0          a1
  3099.  
  3100.  
  3101.     void SetBusError ( void (*)() , void (**)() );
  3102.  
  3103.     FUNCTION
  3104.     This defines the bus error handler which is called in case the
  3105.     MMU library exception handler was not able to handle the fault.
  3106.  
  3107.     This happens for true physical bus errors, errors initiated by
  3108.     the unsupported TAS, CAS and CAS2 instructions using "locked
  3109.     transfers" not supported by the amiga hardware, and MOVE16 in-
  3110.     structions causing an access fault.
  3111.  
  3112.     The default bus error handler is whatever the library finds in
  3113.     the autovectors of the CPU when starting up. It is usually the
  3114.     exec fault handler which presents the nice guru 80000002.
  3115.  
  3116.     INPUTS
  3117.     newfuncptr    - A pointer to the new bus error handler. It is
  3118.             called without any parameters in supervisor state, 
  3119.             with the exception stack frame on the stack.
  3120.     oldfuncptrptr - A pointer to a pointer filled in with the previously
  3121.             defined handler, or NULL.
  3122.  
  3123.     RETURNS
  3124.  
  3125.     NOTES
  3126.     The function pointer is guaranteed to be flushed to memory by
  3127.     the library, the function pointer pointer could be used, for
  3128.     example, to modify the destination of a JMP instruction.
  3129.  
  3130.     The bus error handler *MUST BE IMMEDIATELY* ready for run after
  3131.     this function has to be called.
  3132.  
  3133.     This is a low-level function. You do not want to call it.
  3134.  
  3135.     BUGS
  3136.  
  3137.     SEE ALSO
  3138.  
  3139. mmu.library/GetMMUContextData          mmu.library/GetMMUContextData
  3140.  
  3141.     NAME
  3142.     GetMMUContextData - read MMUContext specific data
  3143.  
  3144.     SYNOPSIS
  3145.     GetMMUContextData ( ctx , id );
  3146.     d0            a0    d0
  3147.  
  3148.     ULONG GetMMUContextData ( struct MMUContext * , ULONG );
  3149.  
  3150.     FUNCTION
  3151.     This function reads various parameters of the MMU context,
  3152.     indexed by an ID from mmu/mmutags.h. All legal tag items
  3153.     of CreateMMContext() are available, plus the following:
  3154.  
  3155.         MGXTAG_PAGESIZE     -       Return the page size in bytes
  3156.                     of the input context. Unlike
  3157.                     MCXTAG_PAGEBITS, this is *NOT*
  3158.                     an exponent. This is identical
  3159.                     to GetPageSize().
  3160.  
  3161.         MGXTAG_REMAPSIZE    -       Returns the alignment restriction
  3162.                     for remapped memory to be added to
  3163.                     the exec memory free list. This is
  3164.                     identical to RemapSize().
  3165.  
  3166.         MGXTAG_ROOT        -       Return the pointer to the root of
  3167.                     the MMU tree. You have to cast the
  3168.                     result to an ULONG *. 
  3169.                     Note that you DO NOT WANT to modify 
  3170.                     this tree directly.
  3171.  
  3172.         MGXTAG_CONFIG       -       Returns the pointer to a 
  3173.                     struct MMUConfig * specifying the
  3174.                     complete MMU configuration for 
  3175.                     this context. You usually DO NOT
  3176.                     NEED to touch this.
  3177.  
  3178.     INPUTS
  3179.     ctx     -       A pointer to a struct MMUContext *.
  3180.  
  3181.     id      -       An ID specifying which data you want to read.
  3182.             NOTE THAT THIS IS NOT A TAG LIST, but just the
  3183.             tag item id from mmutags.h.
  3184.     RETURNS
  3185.     the data requested. You need to cast it to the correct type.
  3186.  
  3187.     NOTES
  3188.  
  3189.     BUGS
  3190.  
  3191.     SEE ALSO
  3192.     CreateMMUContext(), mmu/config.h
  3193.     
  3194. mmu.library/SetMMUContextData            mmu.library/SetMMUContextData
  3195.  
  3196.     NAME
  3197.     SetMMUContextData - define MMU context specifications on the fly
  3198.  
  3199.     SYNOPSIS
  3200.     SetMMUContextDataA ( ctx , tags );
  3201.                  a0    a1
  3202.  
  3203.     SetMMUContextData ( ctx , ... );
  3204.  
  3205.  
  3206.     void SetMMUContextDataA ( struct MMUContext * , struct TagItem * );
  3207.  
  3208.     void SetMMUContextData ( struct MMUContext * , Tag tag1 , ... );
  3209.  
  3210.     FUNCTION
  3211.     This function allows to adjust *some* of the MMUContext 
  3212.     specifications on the fly. The following tag items of the 
  3213.     CreateMMUContext() call are supported:
  3214.  
  3215.         MCXTAG_BLANKFILL    -       define the data to read from the
  3216.                     dummy "blank" pages. Note that
  3217.                     a *working* program should never
  3218.                     read this data.
  3219.  
  3220.         MCXTAG_EXECBASE     -       specify whether or not page 0 will
  3221.                     be threated specially and accesses
  3222.                     to the first Kbyte should be
  3223.                     emulated. If set to FALSE, the 
  3224.                     first page will be threated as all
  3225.                     other pages.
  3226.  
  3227.         MCXTAG_ZEROBASE     -       Specify a base address for where 
  3228.                     possibly emulated zero page accesses
  3229.                     have to be redirected to. This address
  3230.                     is usually ignored unless the zero-
  3231.                     page is invalidated and MCXTAG_EXEBASE
  3232.                     is TRUE. For the messy details, check
  3233.                     the CreateMMUContext() autodocs.
  3234.  
  3235.         MCXTAG_LOWMEMORYLIMIT -     Define the lower boundary of valid
  3236.                     memory, used to emulate access to the
  3237.                     zero page. Defaults to the lower 
  3238.                     boundary of chip memory. (V42)
  3239.  
  3240.     No other tag items are valid here.
  3241.  
  3242.     INPUTS
  3243.     ctx     -       A pointer to a struct MMUContext *.
  3244.  
  3245.     tags    -       A tag list containing the parameters to be
  3246.             adjusted.
  3247.     RETURNS
  3248.  
  3249.     NOTES
  3250.  
  3251.     BUGS
  3252.  
  3253.     SEE ALSO
  3254.     CreateMMUContext(), exec/memory.h
  3255.  
  3256. mmu.library/BuildIndirect              mmu.library/BuildIndirect
  3257.  
  3258.     NAME
  3259.     BuildIndirect       -   build a true hardware page descriptor.
  3260.  
  3261.     SYNOPSIS
  3262.     descr = BuildIndirect ( ctx , address , props );
  3263.     d0            a0      d0    d1
  3264.  
  3265.     ULONG   BuildIndirect ( struct MMUContext * , ULONG , ULONG );
  3266.  
  3267.     FUNCTION
  3268.     This function builds a true hardware page descriptor, to be used for
  3269.     the MAPP_INDIRECT property. 
  3270.  
  3271.     INPUTS
  3272.     ctx     -   the MMUContext handle in which this descriptor is to
  3273.             be used as the destination of a MAPP_INDIRECT descriptor.
  3274.  
  3275.     address -   in case this descriptor is "valid", this is the 
  3276.             PHYSICAL destination address, to be told to the MMU, to
  3277.             which accesses will be redirected to. Unlike 
  3278.             SetProperties(), there is *NO* MAPP_REMAPPED bit. In
  3279.             case you do not want remapping, set this to the logical
  3280.             address. DO NOT LEAVE THIS BLANK or accesses will be
  3281.             redirected to address 0 - which is most likely not want
  3282.             you want. Note that this address must be, as all other
  3283.             addresses the MMU cares about, page aligned!
  3284.             In case this descriptor is of invalid type, the address
  3285.             can be used for your purposes, but note that this MUST
  3286.             STILL be a number which is page aligned for the given
  3287.             context. It *MAY NOT* be arbitrary.
  3288.         
  3289.     props   -   Properties for the descriptor to be defined.
  3290.             NOTE THAT THIS IS A TRUE HARDWARE DESCRIPTOR! The
  3291.             library WILL NOT BE ABLE to help you out by emulating
  3292.             missing features of one MMU or another. Instead, it will
  3293.             just ignore them. This means for you, specifically, 
  3294.             that only a minor subset of the usual properties may be
  3295.             used safely here, and that parsing the hardware 
  3296.             properties later on with GetIndirect() might result in
  3297.             different properties than you intended because of
  3298.             missing features of the MMU in use. To be precise, the
  3299.             following properties *might* be available - meaning that
  3300.             all others ARE NOT!
  3301.  
  3302.         MAPP_WRITEPROTECTED  -  The page will be write protected. 
  3303.             Writes to this area will cause a segmentation fault.
  3304.  
  3305.         MAPP_USED         -   The "used" bit of the pages
  3306.             will be set. The CPU will set this bit automatically
  3307.             as soon as the pages are accessed.
  3308.  
  3309.         MAPP_MODIFIED         -   The "modified" bit of the pages
  3310.             will be set. The CPU will set this bit automatically
  3311.             as soon as a write is performed to the page in question.
  3312.             DO NOT SET THIS BIT TOGETHER WITH MAPP_WRITEPROTECTED
  3313.             OR WITHOUT MAPP_USED or the CPU might hang. 
  3314.  
  3315.         MAPP_INVALID         -   The page will be marked as 
  3316.             invalid. Accessing it will invoke the bus error hook.
  3317.             See below for how to mark this page as REMAIRABLE. Note
  3318.             that the MAPP_REPAIRABLE bit is *here* not available.
  3319.  
  3320.         MAPP_CACHEINHIBIT    -   The page will be marked as non-
  3321.             cacheable.
  3322.  
  3323.         MAPP_IMPRECISE         -   The page will be marked as 
  3324.             "imprecise exception". MAPP_CACHEINHIBIT is mandatory
  3325.             in this case or this flag does nothing. Only avail-
  3326.             able for the 060, ignored and read as zero 
  3327.             by all others.
  3328.  
  3329.         MAPP_NONSERIALIZED   -   The page will be marked as
  3330.             serialized. MAPP_CACHEINHIBIT is mandatory if this
  3331.             property is selected. Only available for the 040, 
  3332.             ignored and read as zero by all others.
  3333.  
  3334.         MAPP_COPYBACK         -   The page will be marked as
  3335.             "copyback" instead of "writethrough". Generally re-
  3336.             commended since this is faster for the '40 and '60.
  3337.             MAPP_CACHEINHIBIT *MUST* be disabled for this to work.
  3338.             Only available for the 040 and 060, ignored and read
  3339.             as zero by others.
  3340.  
  3341.         MAPP_USERPAGE0         -   Set user page attribute 0,
  3342.             only available for the 040 and 060, ignored and read
  3343.             as zero by all others.
  3344.             The status of this bit appears on special pins of the
  3345.             CPU and might be required by some hardware, so don't    
  3346.             play with this. 
  3347.  
  3348.         MAPP_USERPAGE1         -   Set user page attribute 1,
  3349.             see above for details.
  3350.  
  3351.         MAPP_GLOBAL         -   DIFFERENT TO SetProperties()
  3352.             and others! 
  3353.             Set the GLOBAL bit in the page descriptor, only avail-
  3354.             able for the 040 and 060, ignored and read as zero by
  3355.             all others. 
  3356.             Setting this bit means that certain specialized 
  3357.             instructions will not flush this descriptor from the
  3358.             cache (the ATC) of the MMU.
  3359.             The mmu.library writes only descriptors without this
  3360.             bit set and does not use these instructions. It will
  3361.             always flush descriptors independent of the G bit.
  3362.             There is little use of this bit.
  3363.  
  3364.     RESULTS
  3365.     a page descriptor for the current MMU in use, designed and to be
  3366.     used for as the destination of an MAPP_INDIRECT descriptor. NOT
  3367.     to be used as a true page descriptor, and NOT to be used as a 
  3368.     table descriptor.
  3369.     In case the library finds no MMU or the alignment restrictions 
  3370.     aren't satisfied, it will return BAD_DESCRIPTOR (0x03), it 
  3371.     WILL NOT return NULL as this is a "valid invalid" descriptor.
  3372.         
  3373.     NOTES
  3374.     Note specifically that MAPP_SUPERVISORONLY *IS NOT* supported. The
  3375.     mmu.library enforces a distinct user/supervisor model and as such
  3376.     you might want to install an invalid descriptor into the user table
  3377.     and a valid descriptor into the supervisor table to emulate this
  3378.     feature. True "supervisor only" descriptors are available for the
  3379.     040 and 060 anyways, but this "emulation" works for all MMUs.
  3380.  
  3381.     MAPP_REMAPPED is not supported either because you have to specify
  3382.     a physical destination address in all cases, even if no remapping
  3383.     has to be performed. Use the logical address as physical address in
  3384.     case remapping is not desired.
  3385.  
  3386.     MAPP_REPAIRABLE is not available because this flag is in fact an
  3387.     emulation provided by the library. However, you may make access 
  3388.     faults to this page repairable by setting the MAPP_REPAIRABLE bit
  3389.     for the MAPP_INDIRECT descriptor that POINTS to the descriptor 
  3390.     you're building by this call. This will be enough to inform the
  3391.     library about how to treat access faults.
  3392.     
  3393.  
  3394.     How to use this function:
  3395.  
  3396.     Allocate four bytes of memory, long-word aligned, or even 16 bytes 
  3397.     line (16 byte) aligned in case you want to read back the descriptor 
  3398.     later by GetIndirect() and calculate its TRUE PHYSICAL location with 
  3399.     PhysicalLocation(). Use the return code of this function to mask in
  3400.     your properties, DO NOT ASSUME fixed properties. Build a descriptor 
  3401.     with BuildIndirect() and install it into this memory by calling 
  3402.     SetIndirect(). *DO NOT* write it to the memory yourself! 
  3403.     Due to CPU caching effects, this must be done by the library. 
  3404.     Then build a MAPP_INDIRECT descriptor, and tell the library with the
  3405.     MAPTAG_DESCRIPTOR tag of SetProperties() to make it point to your
  3406.     memory. In case you want access faults on this to be repairable,
  3407.     set the MAPP_REPAIRABLE bit for this call. In case you want it write 
  3408.     protected but want to ignore write accesses, set MAPP_ROM, too. Then
  3409.     call RebuildTree() as usual. In case you want to exchange descriptors
  3410.     really fast - this is after all what indirect descriptors are 
  3411.     designed for - build all descriptors you require in a first step
  3412.     and keep them. A single call to SetIndirect() will exchange them
  3413.     VERY RAPIDLY which is ideal for certain applications. 
  3414.     
  3415.     BUGS
  3416.     Much more must be said about this function. It is definitely an
  3417.     advanced feature, so don't play with this in case you don't know
  3418.     what it does.
  3419.  
  3420.     SEE ALSO
  3421.     SetIndirect(), SetIndirectArray(), GetIndirect()
  3422.  
  3423. mmu.library/SetIndirect                mmu.library/SetIndirect
  3424.  
  3425.     NAME
  3426.     SetIndirect     -   Write a page descritor to memory
  3427.  
  3428.     SYNOPSIS
  3429.     SetIndirect ( destination , logical , descriptor );
  3430.             a0          a1      d0
  3431.  
  3432.     void SetIndirect ( ULONG *, ULONG, ULONG );
  3433.  
  3434.     FUNCTION
  3435.     Write a page descriptor, used as the destination of one or
  3436.     several MAPP_INDIRECT descriptors, out to memory and make the MMU
  3437.     aware of the change.
  3438.  
  3439.     INPUTS
  3440.     destination     -   the memory location to which the descriptor
  3441.                 should be written to. This is the same address
  3442.                 specified by MAPTAD_DESCRIPTOR in the corresponding
  3443.                 SetProperties() call. NOTE THAT THIS IS A 
  3444.                 PHYSICAL, NOT A LOGICAL ADDRESS.
  3445.                 This must be long-word aligned, or even 16 bytes 
  3446.                 line-aligned (16 bytes aligned) in case you want 
  3447.                 to read the descriptor later with GetIndirect().
  3448.  
  3449.     logical         -   The logical address covered by this descriptor, 
  3450.                 i.e. the address of the page which this 
  3451.                 descriptor is managing. In case you installed
  3452.                 the same descriptor for several logical addresses,
  3453.                 specify -1L (this will be slower, though.)
  3454.  
  3455.     descriptor      -   The descriptor to install.
  3456.  
  3457.     RESULTS
  3458.     doesn't return a result.
  3459.  
  3460.     NOTES
  3461.     Do NOT try to install a descriptor yourself, even though this 
  3462.     *seems* to be more effective. Somewhat more must be done than just
  3463.     writing the descriptor to memory. This call ensures that the
  3464.     descriptor is really written out to memory, and really fetched by
  3465.     the MMU. Specifying -1L as logical address is possible and supported
  3466.     but *slightly* less efficient than giving the correct 
  3467.     logical address.
  3468.     This call DOES NOT ensure that all data in the page to be modified
  3469.     is really written out. Hence, if you change the cache mode, the
  3470.     protection status or the validity status of a page, you should call
  3471.     CacheClearU() or CacheClearE() before. This step is, however, not
  3472.     required required in case you just changed the physical destination.
  3473.     The library keeps then care about the necessary cache operations
  3474.     itself.
  3475.  
  3476.     This call is *very* effective, there is little reason to try this
  3477.     yourself, not counting the portability problems.
  3478.  
  3479.     In case you want to install more than about four descriptors at once,
  3480.     you should consider using SetIndirectArray() which causes even less 
  3481.     overhead in this situation.
  3482.  
  3483.     BUGS
  3484.  
  3485.     SEE ALSO
  3486.     SetIndirectArray(), GetIndirect(), BuildIndirect()
  3487.  
  3488. mmu.library/SetIndirectArray           mmu.library/SetIndirectArray
  3489.  
  3490.     NAME
  3491.     SetIndirectArray    -   Write multiple page descritors to memory
  3492.  
  3493.     SYNOPSIS
  3494.     SetIndirectArray ( destination , descriptors , number );
  3495.                 a0      a1        d0
  3496.  
  3497.     void SetIndirectArray ( ULONG *, ULONG *, ULONG );
  3498.  
  3499.     FUNCTION
  3500.     Write a complete array of page descriptors at once, re-defining
  3501.     the mapping for more than one page, and make the MMU aware of the
  3502.     changes.
  3503.  
  3504.     INPUTS
  3505.     destination     -   an array in memory which keeps the true hardware
  3506.                 MMU descriptors. This address, and all subsequent
  3507.                 addresses must have been used in the corresponding
  3508.                 SetProperties() call to setup the descriptor.
  3509.                 NOTE THAT THIS IS A PHYSICAL ADDRESS. Note further
  3510.                 that it is up to you to ensure that the 
  3511.                 (obviously continuous) array of logical addresses
  3512.                 is not fragmentated into several physical memory
  3513.                 blocks. If this happens, you would have to call
  3514.                 this routine several times, once for each dis-
  3515.                 continuous block.
  3516.                 This must be long-word aligned, or even a multiple
  3517.                 of a 16 byte line-aligned array in case you want
  3518.                 to read the descriptor later with GetIndirect().
  3519.  
  3520.     descriptors     -   An array of pre-calculated descriptor values to be
  3521.                 filled in. This is a logical address. Effectively,
  3522.                 this call copies this array to its first argument.
  3523.  
  3524.     number          -   The number of the descriptors to be defined. Zero
  3525.                 is allowed here, and is a no-op.
  3526.  
  3527.     RESULTS
  3528.     doesn't return a result.
  3529.  
  3530.     NOTES
  3531.     Do NOT try to install descriptors yourself, even though this 
  3532.     *seems* to be more effective. Somewhat more must be done than just
  3533.     writing the descriptors to memory. This call ensures that the
  3534.     descriptors are really written out to memory, and really fetched by
  3535.     the MMU. Note that this call does not require the logical address
  3536.     of the page(s) which are about to be changed, quite different to
  3537.     SetIndirect(). It will be therefore slower than SetIndirect() if
  3538.     only very descriptors are to be written.
  3539.     This call DOES NOT ensure that all data in the page(s) to be modified
  3540.     is really written out. Hence, if you change the cache mode, the
  3541.     protection status or the validity status of a page, you should call
  3542.     CacheClearU() or CacheClearE() before. 
  3543.     This step is not required in case you just change the physical
  3544.     destination of the pages involved, the library is able to handle
  3545.     this transparently.
  3546.  
  3547.     This call is *very* effective, there is little reason to try this
  3548.     yourself, not counting the portability problems.
  3549.  
  3550.     If you install only one descriptor, SetIndirect() is more effective.
  3551.     Note further that this call does not require the logical address of
  3552.     the page(s) to be provided, it will flush the complete ATC of the
  3553.     MMU and is therefore slower if only a few pages or even a single page
  3554.     has to be modified. 
  3555.  
  3556.     BUGS
  3557.  
  3558.     SEE ALSO
  3559.     SetIndirect(), GetIndirect(), BuildIndirect()
  3560.  
  3561. mmu.library/GetIndirect                mmu.library/GetIndirect
  3562.  
  3563.     NAME
  3564.     GetIndirect     -   Read a hardware page descritor from memory
  3565.  
  3566.     SYNOPSIS
  3567.     GetIndirect ( ctx , adt , address );
  3568.               a0    a1      d0
  3569.  
  3570.     void GetIndirect ( struct MMUContext *, 
  3571.                struct AbstractDescriptor *, ULONG * );
  3572.  
  3573.     FUNCTION
  3574.     Reads a true hardware page descriptor, used as the destination 
  3575.     of one or several MAPP_INDIRECT descriptors, and places its data
  3576.     in the AbstractDescriptor structure.
  3577.  
  3578.     INPUTS
  3579.     ctx        -   the MMU context handle this page descriptor
  3580.                 belongs.
  3581.     adt        -   An abstract table descriptor, to be filled
  3582.                 out with the descriptor data.
  3583.     address         -   the address from where the descriptor is to 
  3584.                 be read. This is the same address which has been
  3585.                 passed as argument to the MAPTAG_DESCRIPTOR
  3586.                 tag of the SetProperties() call when building
  3587.                 the indirect descriptor.
  3588.                 All descriptors to be read by this function must
  3589.                 reside in a separate cache line, i.e. must be
  3590.                 part of a line (16 byte) aligned array which is a
  3591.                 multiple of 16 bytes long. In all other cases,
  3592.                 this call could return improper results due to
  3593.                 cache clashes.
  3594.     
  3595.     RESULTS
  3596.     no direct result code, but the AbstractDescriptor is filled
  3597.     in as follows:
  3598.  
  3599.     struct AbstractDescriptor {
  3600.         ULONG       atd_Pointer;
  3601.         ULONG       atd_Properties;
  3602.         UWORD       atd_LowerLimit;
  3603.         UWORD       atd_UpperLimit;
  3604.         UBYTE       atd_ThisType;
  3605.         UBYTE       atd_NextType;
  3606.         UWORD       atd_reserved;
  3607.     };
  3608.  
  3609.     atd_Pointer is either the physical address the accesses to the
  3610.     page(s) this descriptor is installed for are redirected to, or
  3611.     the user data if this descriptor is of invalid type. This is the
  3612.     same value that was passed in as "address" argument to the
  3613.     corresponding BuildIndirect() call.
  3614.  
  3615.     atd_Properties is the set of MMU properties read from the 
  3616.     descriptor. This NEED NOT to be identical to the properties setup
  3617.     by BuildIndirect(), for two reasons: First, the MMU sets the
  3618.     USED and MODIFIED attributes as soon as any access or a write
  3619.     access happens to the page(s) handled by the descriptor. Second,
  3620.     not all MMUs support all properties. Unavailable properties are
  3621.     ignored by BuildIndirect(), and read as zero by this function.
  3622.  
  3623.     All other fields are currently not documented and should not be
  3624.     read.
  3625.  
  3626.     NOTES
  3627.     Do NOT try to read a descriptor yourself, even though this 
  3628.     *seems* to be more effective. Somewhat more care must be kept for
  3629.     doing this. NOT following this rule might even lock up your
  3630.     machine!
  3631.  
  3632.     This call is *very* effective, there is little reason to try this
  3633.     yourself, not counting the portability problems.
  3634.  
  3635.     BUGS
  3636.  
  3637.     SEE ALSO
  3638.     SetIndirect(), BuildIndirect(), mmu/descriptor.h
  3639.